doupi3874 2011-03-08 20:12
浏览 36

连接到版本5.0 mysql时当前语法错误

I am really having a tough time understanding what syntax to use. I am VERY green when it comes to coding. I copied this code from another website that is working just fine but they are hooked up to a 4.3 version of mysql- can anyone help?This is the error-

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 '1, city, state, zip, ) VALUES ('', , ' 1', '', '', '','' )' at line 1

Here is my code:

mysql_select_db("membership70", $con);  

$name=mysql_real_escape_string($_POST['Name']); 
$address1=mysql_real_escape_string($_POST['Address1']); 
$city=mysql_real_escape_string($_POST['city']); 
$state=mysql_real_escape_string($_POST['state']); 
$zip=mysql_real_escape_string($_POST['zip']);
$email=mysql_real_escape_string($_POST['email']);

$sql="INSERT INTO Members (name, email, adress 1, city, state, zip, ) VALUES ('$name', , '$address 1', '$city', '$state', '$zip','$email' )"; 

if (!mysql_query($sql,$con)) {
  die('Error: ' . mysql_error());
}
  • 写回答

4条回答 默认 最新

  • dongxian7489 2011-03-08 20:17
    关注

    Get rid of the space in adress 1 and your variable $adress 1....not allowed (spaces that is)

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?