我正在尝试一次更新多个列:
$query="UPDATE search_page
SET search_page_description='".$search_page_description."',
SET title='".$title."',
SET h1='".$h1."',
SET meta_description='".$metadata."'
WHERE features_id=".$id;
$result_update_query=databaseConn :: dbDelta($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 'SET title='fasdf', SET h1='fasdfas', SET meta_description='fas' at line 3
我的代码在哪里出错?
答案 0 :(得分:5)
您只需要一个SET
关键字
$query="UPDATE search_page
SET search_page_description='".$search_page_description."',
title='".$title."',
h1='".$h1."',
meta_description='".$metadata."'
WHERE features_id=".$id;
$result_update_query=databaseConn :: dbDelta($query);
答案 1 :(得分:1)
错误说明第3行:
“SET title ='”。$ title。“',”
问题是此行包含不期望的“SET”关键字。
$query="UPDATE search_page
SET search_page_description='".$search_page_description."',
title='".$title."',
h1='".$h1."',
meta_description='".$metadata."'
WHERE features_id=".$id;
$result_update_query=databaseConn :: dbDelta($query);
答案 2 :(得分:1)
试试这些:
> $query="UPDATE search_page
> SET search_page_description='".$search_page_description."',
> title='".$title."',
> h1='".$h1."',
> meta_description='".$metadata."'
> WHERE features_id=".$id;
> $result_update_query=databaseConn :: dbDelta($query);