php - Mysql query error with syntax -
i have query , can't figure out incorrect:
mysql_query ("update 'users' set 'profile'='".$file_path."'where 'id'=".(int)$user_id)or die ("error in query: $query. ".mysql_error()); here error: error in query: . have error in sql syntax; check manual corresponds mysql server version right syntax use near ''users' set 'profile'='images/profiles/7fe0e816b0.jpg'where 'id'=72' @ line 1
try backticks instead of single-quotes like
mysql_query ("update `users` set `profile`='".$file_path."' `id`=".(int)$user_id) or die ("error in query: $query. ".mysql_error()); and try avoid mysql_* statements due entire ext/mysql php extension, provides functions named prefix mysql_*, officially deprecated of php v5.5.0 , removed in future.
there 2 other mysql extensions can better use: mysqli , pdo_mysql, either of can used instead of ext/mysql.
Comments
Post a Comment