代码如下
<?php
$newstu="insert into regstudent(username,stupswd,name,sex,stuidcard,stumobile,stuzone,stuadd,stupost,stuxx,stuzy,)value('$username','$stupswd','$name','$sex','$stuidcard','$stumobile','$stuzone','$stuadd','$stupost','$stuxx','$stuzy')";
if(mysql_query($newstu))echo "<script language=javascript>alert('注册成功');document.location.href('index.php');</script>";
else echo $newstu;
?>
可是信息填入后数据进不了数据库 为什么?

解决方案 »

  1.   

    insert into `regstudent` values('$username','$stupswd','$name','$sex','$stuidcard','$stumobile','$stuzone','$stuadd','$stupost','$stuxx','$stuzy')values 不是value 如果还不行,就是你的字段个数没有对应上
      

  2.   

    是values 不是value 
    注意标点符号
      

  3.   

    1.楼上已经说了 values
    2.values() 括号里面的 变量你用单引号 估计不太对吧我觉得你最好是打印输出一下sql语句 看看是否正确
      

  4.   

    没有对特殊符号进行转义,对于长文本使用:mysqli_real_escape_string(这里是长文本变量名);再使用insert into table(...) values(mysqli_real_escape_string(这里是长文本变量名),....)即可
      

  5.   

    $newstu="insert into regstudent(username,stupswd,name,sex,stuidcard,stumobile,stuzone,stuadd,stupost,stuxx,stuzy,)value('$username','$stupswd','$name','$sex','$stuidcard','$stumobile','$stuzone','$stuadd','$stupost','$stuxx','$stuzy')";
    改成values试试看 把数据放到数据库中试一试
      

  6.   

    是values 不是value  
      

  7.   

    sql语句要养成在查询分析器里测试在放入php
      

  8.   

    1,先将value变成values。
    2,输出sql语句看看,
    3,讲你的输出的sql语句拿到mysql里面看看,看可以添加不?