欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

大家帮忙找下问题所在 我实在看不出来

程序员文章站 2024-01-06 15:34:52
...
$sql_insert = "insert into tb_user (usernc,turename,pwd,email,sex,tel,qq,address,logintimes,regtime,lastlogintime,ip,yb,usertype,question,answer,truepwd,photo,score) values('$_POST[usernc]','$_POST[truename]','" . md5($psw) . "','$_POST[email]','$_POST[select]','$_POST[tel]','$_POST[qq]','$_POST[address]','0','" . date('Y-m-d H:i:s') . "','" . date('Y-m-d H:i:s') . "','" . $_SERVER['REMOTE_ADDR'] . "',' $_POST[yb]','0','$_POST[question]','$_POST[answer]','$_POST[truepwd]','$_POST[photo];','30')";
$res_insert = mysql_query($sql_insert);
//$num_insert = mysql_num_rows($res_insert);
if($res_insert)
{
echo "";
}
else
{
echo "";
}


回复讨论(解决方案)

信息填完点注册只能跳转到系统繁忙,我觉得是自己的sql语句有问题 但找不出来

{
echo "";
}
改为
{
$msg = mysql_error();
echo "";
}
看看弹出框中是什么

弹不出来 直接空白的

$sql_insert = "insert into tb_user (usernc,turename,pwd,email,sex,tel,qq,address,logintimes,regtime,lastlogintime,ip,yb,usertype,question,answer,truepwd,photo,score) values('$_POST[usernc]','$_POST[truename]','" . md5($psw) . "','$_POST[email]','$_POST[select]','$_POST[tel]','$_POST[qq]','$_POST[address]','0','" . date('Y-m-d H:i:s') . "','" . date('Y-m-d H:i:s') . "','" . $_SERVER['REMOTE_ADDR'] . "',' $_POST[yb]','0','$_POST[question]','$_POST[answer]','$_POST[truepwd]','$_POST[photo] ;','30')";
套红处???

额 去了也不行

如果是 sql 指令错误,mysql 是会给你提示的
你不看,怎么行?

$msg = mysql_error();
echo "";
这局加过了 是弹不出来信息

直接显示空白的话,就说明你的程序有语法错误,且错误显示功能没有打开
你只给了程序片段,无法判断问题的所在

require_once 'conn.php';
if(isset($_POST["submit"]) && $_POST["submit"] == "注册")
{

$user = $_POST["usernc"];
$trueuser=$_POST["truename"];
$psw = $_POST["pwd"];
$psw_truepwd = $_POST["truepwd"];
$email = $_POST["email"];
$sex = $_POST["select"];
$tel = $_POST["tel"];
$qq = $_POST["qq"];
$address = $_POST["address"];
$yb = $_POST["yb"];
$question = $_POST["question"];
$answer = $_POST["answer"];
$photo= $_POST["photo"];
if($user == "" || $trueuser == ""|| $psw == ""|| $psw_truepwd == ""|| $email == ""|| $sex == ""|| $tel == ""|| $qq == ""|| $address == ""|| $yb == ""|| $question == ""|| $photo == ""|| $answer == "")
{
echo "";
}
else
{
if($psw == $psw_truepwd)
{
$sql = "select usernc from tb_user where usernc = '$_POST[usernc]'"; //SQL语句
$result = mysql_query($sql); //执行SQL语句
$num = mysql_num_rows($result); //统计执行结果影响的行数
if($num) //如果已经存在该用户
{
echo "";
}
else //不存在当前注册用户名称
{

$sql_insert = "insert into tb_user (usernc,turename,pwd,email,sex,tel,qq,address,logintimes,regtime,lastlogintime,ip,yb,usertype,question,answer,truepwd,photo,score) values('$_POST[usernc]','$_POST[truename]','" . md5($psw) . "','$_POST[email]','$_POST[select]','$_POST[tel]','$_POST[qq]','$_POST[address]','0','" . date('Y-m-d H:i:s') . "','" . date('Y-m-d H:i:s') . "','" . $_SERVER['REMOTE_ADDR'] . "',' $_POST[yb]','0','$_POST[question]','$_POST[answer]','$_POST[truepwd]','$_POST[photo]','30')";
$res_insert = mysql_query($sql_insert);
//$num_insert = mysql_num_rows($res_insert);
if($res_insert)
{
echo "";
}
else
{

$msg = mysql_error();
echo "";
//echo "";
}
}
}
else
{
echo "";
}
}
}
else
{
echo "";
}
?>
这是全部的代码 其实别的都能跳转能用就那段有点问题

把 $res_insert = mysql_query($sql_insert);
改为 $res_insert = mysql_query($sql_insert) or die(mysql_error());

Unknown column 'turename' in 'field list' 额求解

好吧 我的错 字打错了

哎 实在是太马虎了 不过学到了怎么找sql问题 谢谢大神

turename 列不存在