I wrote code that is suposed to update the "user level" stored in the column "level" in the table "users", for the user specified by the variable "$x5_input_username".
$x_changelvl_sql = "UPDATE users SET level='$x5_input_newlevel' WHERE `username`=$x5_input_username";
When I do this using the userlevel "2" and username "TestUser" (which both exist in the database), it gives me this error:
Error updating record: Unknown column 'TestUser' in 'where clause'
Quote your string in the where clause
$x_changelvl_sql = "UPDATE users
SET level='$x5_input_newlevel'
WHERE `username`='$x5_input_username'";
Better yet, start using MySQLi with prepared statements and bind variables
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.