Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php mysql update语句给了我一个错误_Php_Mysql - Fatal编程技术网

Php mysql update语句给了我一个错误

Php mysql update语句给了我一个错误,php,mysql,Php,Mysql,我正在尝试一次更新多个列: $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_updat

我正在尝试一次更新多个列:

  $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
我的代码哪里出错了?

您只需要一个SET关键字


参见ref:

错误显示第3行,因此:

设置标题=“.$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);
请参阅或尝试

尝试以下内容:

>   $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);
>   $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);