Spring Posted May 5, 2011 Share Posted May 5, 2011 I've tried the PHPBB help forum and no one has answered. I thought i'd try here. For some reason i'm getting this weird error when I attempt to post. SQL ERROR [ mysqli ] Unknown column 'Tony' in 'where clause' [1054] SQL UPDATE phpbb_users SET user_gold = 50 WHERE username =Tony Tony is in the username row. What am I doing wrong? here's the code I'm using. if (($mode == 'reply' || $mode == 'quote' || $mode == 'post')) { $sql = "UPDATE phpbb_users SET user_gold = 50 WHERE username =" . $user->data['username'] . ""; $db->sql_query($sql); } Quote Link to comment https://forums.phpfreaks.com/topic/235568-phpbb3-sql-error-please-be-familiar-with-phpbb/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 5, 2011 Share Posted May 5, 2011 I've tried the PHPBB help forum and no one has answered. Probably because the error has nothing to do with phpbb. It's a basic sql question. String data in a query must be enclosed by single quotes. Without the single-quotes, the query is treating the username as a column name. $sql = "UPDATE phpbb_users SET user_gold = 50 WHERE username ='" . $user->data['username'] . "'"; Quote Link to comment https://forums.phpfreaks.com/topic/235568-phpbb3-sql-error-please-be-familiar-with-phpbb/#findComment-1210725 Share on other sites More sharing options...
Spring Posted May 5, 2011 Author Share Posted May 5, 2011 Sigh. I tend to make myself looker stupider by the day. I should quit php. Quote Link to comment https://forums.phpfreaks.com/topic/235568-phpbb3-sql-error-please-be-familiar-with-phpbb/#findComment-1210727 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.