【发布时间】:2015-01-16 06:27:51
【问题描述】:
我收到这个错误,我是编程新手,如果我错了,请纠正。谢谢
<?
$customername = $_REQUEST["customername"];
//$customername = strtoupper($customername);
//$customername = trim($customername);
$address1=$_REQUEST["address1"];
$address2=$_REQUEST["address2"];
$city = $_REQUEST["city"];
$state = $_REQUEST["state"];
$pincode = $_REQUEST["pincode"];
$phonenumber1 = $_REQUEST["phonenumber1"];
$phonenumber2 = $_REQUEST["phonenumber2"];
$emailid1 = $_REQUEST["emailid1"];
$mobilenumber = $_REQUEST["mobilenumber"];
$sql = "insert into master_customer (id,customername,address1,address2,city,state,pincode,phonenumber1,phonenumber2,emailid1,mobilenumber)
values ('','$customername','$address1','$address2','$city','$state','$pincode','$phonenumber1','$phonenumber2','$emailid1','$mobilenumber')";
$exec = mysql_query($sql) or die ("Error in Query".mysql_error());
?>
【问题讨论】:
-
看起来你有两个逗号并排没有一个空字符串。如果你要将请求值直接放入 SQL 查询中,请确保去掉引号等..(目前这是一个巨大的安全风险)
-
我认为错误信息不能来自这个语句。这个表上可能有触发器吗?
-
在错误中指定了 NOW() 部分,这是一个日期插入查询。您提供了不相关的代码。尝试在您的脚本中找到与日期有关的查询。
-
这不是产生错误的查询,向我们展示实际的查询。
-
我找不到与该错误有关的任何其他信息,db 表给出错误?我怀疑但是。谢谢