Doo*_*der 2 php mysql syntax insert
我正在使用预先编写的脚本的修改版本.它在网站的其他地方工作,但我无法弄清楚我在这里错过了什么...
$insertQuery = "INSERT INTO cmsportfolio (status,title,imgurl,imgthumb,section,url,`desc`,type) VALUES (".
"'".$HTTP_POST_VARS['status']."', ".
"'".$HTTP_POST_VARS['title']."', ".
"'".addslashes($HTTP_POST_VARS['imgurl'])."', ".
"'".addslashes($HTTP_POST_VARS['imgthumb'])."', ".
"'".$HTTP_POST_VARS['section'].", ".
"'".addslashes($HTTP_POST_VARS['url'])."', ".
"'".addslashes($HTTP_POST_VARS['desc'])."', ".
"'".$HTTP_POST_VARS['type']."' )";
if ($result = $connector->query($insertQuery)){
header('Location: ' . $_SERVER['PHP_SELF'].'?action=addsuccess');
exit;
}else{
echo "Error message = ".mysql_error();
exit('<center>Sorry, there was an error saving to the database</center>');
}
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在第1行" http://www.xxxxxxxx.co.uk ","frgdr tr tr","0")附近使用正确的语法对不起,有一个错误保存到数据库
(错误指的是查询的最后3个字段)