我需要插入2张桌子时出现错误

时间:2018-07-16 05:09:58

标签: php html sql

    $Rnameth = $_POST['Rnameth'];
    $Rnameeng = $_POST['Rnameeng'];
    $faculty=$_POST['faculty'];
    $major = $_POST['major'];
    $Rdename_thf=$_POST['Rdename_thf'];
    $Rdename_ths=$_POST['Rdename_ths'];
    $Rdename_engf=$_POST['Rdename_engf'];
    $Rdename_engs=$_POST['Rdename_engs'];
    $Rsubject=$_POST['Rsubject'];
    $Rcredit=$_POST['Rcredit'];
    $Rstatus=$_POST['Rstatus'];
    $approv1=$_POST['approv1'];
    $Ryear=$_POST['Ryear'];

    $Pname=$_POST['Pname'];
    $Pidcard=$_POST['Pidcard'];
    $Pposition=$_POST['Pposition'];
    $Pnamereg=$_POST['Pnamereg'];


 $sql = "INSERT INTO curriculum_reg(`Rnameth`, `Rnameeng`, `faculty`, `major`, `Rdename_thf`, `Rdename_ths`, `Rdename_engf`, `Rdename_engs`, `Rsubject`, `Rcredit`, `Rstatus`, `approv1`, `Ryear`) 
        VALUES('$Rnameth','$Rnameeng','$faculty','$major','$Rdename_thf','$Rdename_ths','$Rdename_engf','$Rdename_engs','$Rsubject','$Rcredit','$Rstatus','$approv1','$Ryear', '$Rfile'); 
        INSERT INTO professor (`Pname`, `Pidcard`, `Pposition`, `Pnamereg`) VALUES ('$Pname', '$Pidcard', '$Pposition', '$Pnamereg'LAST_INSERT_ID());";
        $query = mysqli_query($con,$sql)or die(mysqli_error($con) . "<br>".$sql);
        mysqli_multi_query($con,$sql);

1 个答案:

答案 0 :(得分:-1)

您的 curriculum_reg 表中的列数为13,而您要插入的值为14,请检查查询,并输入tri来插入agen。

并删除 $ Rfile 变量