php - MySQLi UPDATE where clause not working -
i wrote code suposed update "user level" stored in column "level" in table "users", user specified variable "$x5_input_username".
$x_changelvl_sql = "update users set level='$x5_input_newlevel' `username`=$x5_input_username";
when using userlevel "2" , username "testuser" (which both exist in database), gives me error:
error updating record: unknown column 'testuser' in 'where clause'
quote string in where clause
$x_changelvl_sql = "update users set level='$x5_input_newlevel' `username`='$x5_input_username'";
better yet, start using mysqli prepared statements , bind variables
Comments
Post a Comment