update SQL 语句的语法错误

Syntax error on update SQL statement

当我想在 url 列上使用 md5 时出现语法错误。不确定它有什么问题:

update table {$GLOBALS['tables']['tableame']} set urlhash = md5(url)

错误信息:

Database error 1064 while doing query You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table tablename set urlhash = md5(url)' at line 1

尝试用单引号传递 md5,因为它是一个字符串

update {$GLOBALS['tables']['tableame']} set urlhash = 'MD5_URL_HERE'

语法如下

UPDATE table_name SET column_name = `new_value' [WHERE 条件];