need help with my query script. any help greatly appreciated
Im having trouble getting my login to work on my site.
it keeps telling me query failed, but when i echo out the username and password it matches the one on the server so i dont understand why its not working. heres a link to my site http://trieste.sdsu.edu/~trst016/proj2/proj2.html
Im a new programmer by the way very noob.
$sql = "SELECT username, password FROM faculty WHERE username = $user AND password = $pass";
If you don't put the variables in the SQL-Statements into quotes, they are used as column names. It should be something like this:
$sql = "SELECT username, password FROM faculty WHERE username = \"$user\" AND password = \"$pass\"";
$sql = "select username,password from faculty where (username=\"".$user."\" && password=\"".$pass."\")";
I find symbols prevent ambiguation with the query words
absolute on the quotes too.
|All times are GMT +2. The time now is 21:44.|
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.