php怎么不能添加到数据库呢
怎么不能添加到数据库呢<?phpinclude("common.php");//if(!isset($_SESSION['user_info']))//exit();//...
怎么不能添加到数据库呢<?php
include("common.php");
//if(!isset($_SESSION['user_info']))
//exit();
//$uid=$_SESSION['user_info']['uid'];
$uid=$_POST['uid'];
$name=$_POST['name'];
$dq=$_POST['dq'];
$id_type=$_POST['id_type'];
$id_num=$_POST['id_num'];
$zhuti=$_POST['zhuti'];
$xinxi=$_POST['xinxi'];
$sql=mysql_query("INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,'$name','$dq','$id_type','$id_num','$zhuti','$xinxi')");
$result=mysql_query($sql);
if($result)
{echo "alert('信息发布成功')";}
else
{echo "<a href='xinxi.php'>请重新发布</a>";}
?> 展开
include("common.php");
//if(!isset($_SESSION['user_info']))
//exit();
//$uid=$_SESSION['user_info']['uid'];
$uid=$_POST['uid'];
$name=$_POST['name'];
$dq=$_POST['dq'];
$id_type=$_POST['id_type'];
$id_num=$_POST['id_num'];
$zhuti=$_POST['zhuti'];
$xinxi=$_POST['xinxi'];
$sql=mysql_query("INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,'$name','$dq','$id_type','$id_num','$zhuti','$xinxi')");
$result=mysql_query($sql);
if($result)
{echo "alert('信息发布成功')";}
else
{echo "<a href='xinxi.php'>请重新发布</a>";}
?> 展开
3个回答
展开全部
<?php
/**
*这段语句有问题
*/
$sql=mysql_query("INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,'$name','$dq','$id_type','$id_num','$zhuti','$xinxi')");
//改为
$sql="INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,$name,$dq,$id_type,$id_num,$zhuti,$xinxi)";
mysql_query($sql);
//或者加转义
$sql=mysql_query("INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,\'$name\',\'$dq\',\'$id_type\',\'$id_num\',\'$zhuti\',\'$xinxi\')");
展开全部
跟踪一下你的SQL语句,看下结果是多少,然后检查一下是否是字段不正确等
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
运行下你的SQL语句看看能不能执行成功。
$sql="INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,'$name','$dq','$id_type','$id_num','$zhuti','$xinxi')";$result=mysql_query($sql);
你多了个mysql_query
$sql="INSERT INTO user_more (uid,name,dq,id_type,id_num,zhuti,xinxi)VALUES(NULL,'$name','$dq','$id_type','$id_num','$zhuti','$xinxi')";$result=mysql_query($sql);
你多了个mysql_query
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询