my code are not working, maybe because of the where statement. please help me with what is wrong with this line of code.
query:
mysql_query("UPDATE tblceas_vote SET fldpassword= $three WHERE fldstudno =$login");
my code are not working, maybe because of the where statement. please help me with what is wrong with this line of code.
query:
mysql_query("UPDATE tblceas_vote SET fldpassword= $three WHERE fldstudno =$login");
Quotes will probably help:
mysql_query("UPDATE tblceas_vote SET fldpassword= '$three' WHERE fldstudno ='$login'");
Otherwise the proper way is to use escaping: http://php.net/manual/en/function.mysql-real-escape-string.php
Put single quotes or escape the string:
mysql_query("UPDATE tblceas_vote SET fldpassword='$three' WHERE fldstudno='$login'");
Or
mysql_query("UPDATE tblceas_vote SET fldpassword='".$three."' WHERE fldstudno='".$login."'");
Also note that MYSQL is deprecated and you should use MySQLi or PDO instead.
I agree. Quote are definitely required for text within queries. Also I would suggest you "escape" you content (have a look at mysqli_real_escape_string).
If you ever encounter a "quote" inside your string, it will break your query, unless you escape it.