CORT0619 Posted November 5, 2011 Share Posted November 5, 2011 Hi all, I have a table setup and one of the rows called current_user is setup as a tinybit(1) because I would like to use it as a true/false field. When the user logs in I would like to do an update to that field and set it to true to let me know that the user is current. However, I am having trouble with the mysql in my php code. I currently have: "UPDATE table SET current_user = 1 WHERE id='$id'"; but for some reason it's not working. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/250477-updating-a-tinybit-field-using-php/ Share on other sites More sharing options...
trq Posted November 5, 2011 Share Posted November 5, 2011 Post your code. Quote Link to comment https://forums.phpfreaks.com/topic/250477-updating-a-tinybit-field-using-php/#findComment-1285124 Share on other sites More sharing options...
CORT0619 Posted November 5, 2011 Author Share Posted November 5, 2011 The mysql thats not working is "UPDATE table SET current_user = 1 WHERE id='$id'"; Quote Link to comment https://forums.phpfreaks.com/topic/250477-updating-a-tinybit-field-using-php/#findComment-1285126 Share on other sites More sharing options...
trq Posted November 5, 2011 Share Posted November 5, 2011 Post your code. Quote Link to comment https://forums.phpfreaks.com/topic/250477-updating-a-tinybit-field-using-php/#findComment-1285130 Share on other sites More sharing options...
seany123 Posted November 5, 2011 Share Posted November 5, 2011 well from the little code you have posted i am guessing its a problem with $id. Quote Link to comment https://forums.phpfreaks.com/topic/250477-updating-a-tinybit-field-using-php/#findComment-1285134 Share on other sites More sharing options...
mikosiko Posted November 5, 2011 Share Posted November 5, 2011 The mysql thats not working is "UPDATE table SET current_user = 1 WHERE id='$id'"; ... hopefully your table is not named "table" as you posted http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/250477-updating-a-tinybit-field-using-php/#findComment-1285144 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.