mikk809h Posted May 14, 2013 Share Posted May 14, 2013 (edited) Hello Pro's! Im making a webpage, where i post a license key to it, and then the webpage has to edit the column "unlock" in the database "register_advlock" but. when debugging its returning false $res = mysql_query("UPDATE register_advlock SET unlock='false' WHERE license_key='$key' AND unlock='true'", $con); -- somehow this returns false (connection to database is succesfully done) if ($res) { echo 'true'; } else { echo 'false'; } but when doing or die(mysql_error()) after the mysql query it returns: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unlock='false' WHERE license_key='c83df0043dc323ae1ac1c62e24ab86871cc4cb36568416' at line 1" Thanks in Advance Edited May 14, 2013 by mikk809h Quote Link to comment https://forums.phpfreaks.com/topic/278001-php-edit-single-column-in-database-returns-false/ Share on other sites More sharing options...
requinix Posted May 14, 2013 Share Posted May 14, 2013 "unlock" is a reserved word. Quote Link to comment https://forums.phpfreaks.com/topic/278001-php-edit-single-column-in-database-returns-false/#findComment-1430072 Share on other sites More sharing options...
Kingy Posted May 14, 2013 Share Posted May 14, 2013 Putting ` characters around unlock should get it to work: `unlock`. Either that or change the column name to not use a reserved word. Quote Link to comment https://forums.phpfreaks.com/topic/278001-php-edit-single-column-in-database-returns-false/#findComment-1430077 Share on other sites More sharing options...
mikk809h Posted May 15, 2013 Author Share Posted May 15, 2013 Thanks!!! now i found the problem.. as you said "unlock" was a reserver word, but if i added 'unlock' (the ' ´s) then it still doesnt work.. but now i've changed unlock to "locked" Thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/278001-php-edit-single-column-in-database-returns-false/#findComment-1430149 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.