PHP + Mysql 插入数据问题

asghost asghost 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
代码如下
<?php
$con = mysql_connect('localhost', 'root', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbtravel", $con);
$sql="INSERT INTO dbform
VALUES
('$_POST[firstname]','$_POST[middlename]','$_POST[lastname]','$_POST[street]','$_POST[city]','$_POST[country]','$_POST[zipcode]','$_POST[telephone]','$_POST[mobile]','$_POST[email]','$_POST[url]','$_POST[comments]','$_POST[newsopt]',curdate(),now());";



if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($con)
?>
执行插入错误代码如下:
Error: 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 ','ccc','garden','beijing','china','730107','12931028','19283091283','opopo' at line 3
...全文

相关推荐

评论 11
收藏 已收藏
分享
返回顶部
asghost
基础编程 21,889 成员 140,329 内容