php mysql执行插入语句报错 5
$sql="insertintotest1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,do...
$sql="insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result')";
$result=mysql_query($sql);
if(!$result)
{
echo "插入失败";
}
else
echo "插入成功";
当代码是上面的执行就成功
但是当代码变成下面的就不能执行了,只是多加了一个$add,
print"$add";这句这行成功
$sql="insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result,add) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result','$add')";
$result=mysql_query($sql);
if(!$result)
{
echo "插入失败";
}
else
echo "插入成功";
而且
在mysql中执行
insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result');是正确的,可以插入
但是执行
insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result,add) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result','$add');错误,不能执行。
table名:test1
表头包括:num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result,add
执行mysql语句时values中已经换成对应的内容了。 展开
$result=mysql_query($sql);
if(!$result)
{
echo "插入失败";
}
else
echo "插入成功";
当代码是上面的执行就成功
但是当代码变成下面的就不能执行了,只是多加了一个$add,
print"$add";这句这行成功
$sql="insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result,add) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result','$add')";
$result=mysql_query($sql);
if(!$result)
{
echo "插入失败";
}
else
echo "插入成功";
而且
在mysql中执行
insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result');是正确的,可以插入
但是执行
insert into test1(num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result,add) values('$str','$name','$sex','$age','$telephone','$hospital','$id','$area','$bed','$sample','$num','$doctor','$data','$dig','$object','$result','$add');错误,不能执行。
table名:test1
表头包括:num1,name,sex,age,telephone,hospital,id,arear,bed,sample,num,doctor,data,dis,subobject,result,add
执行mysql语句时values中已经换成对应的内容了。 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询