有3张桌子“学生”,“部门”,“prev_edu”...表学生是家长,其'ID'是FK在其他...我插入记录,但在其他两个表(部,prev_edu)的SQL不工作....只是插入数据到表'学生'... ..有具体的代码..(usnig php我的管理员)....应该有什么?有3张桌子“学生”,“部门”,“prev_edu”... tbl学生是家长,其'ID'是其他人的FK
if($query=="insert_student"){
$sql ="Insert Into student Values(' ','".$_POST["txtName"]."','".$_POST["txtfatherName"]."','".$_POST["txtdob"]."','".$_POST["txtgender"]."','".$_POST["txtcnic"]."','".$_POST ["txtMstatus"]."','".$_POST["txtemail"]."','".$_POST["txtaddress"]."','".$_POST["txtoccupation"]."','".$_POST["txtcommaddress"]."','".$_POST["txtnationality"]."','".$_POST["txtrstatus"]."','".$_POST["txtphoneno"]."','".$_POST["txtmob"]."')";
if(mysql_query($sql,$link)){
$sqlrs = "Insert Into dept Values('?','".$_POST["txtcampus"]."','".$_POST["txtprogram"]."','".$_POST["txtDegree"]."','')";
if(mysql_query($sqlrs,$link)){
$sqlrss = "INSERT INTO prev_edu VALUES ('?','".$_POST["txtClass1"]."','".$_POST["txtYear1"]."','".$_POST["txtAnnual1"]."','".$_POST["txtRollno1"]."','".$_POST["txtMarks1"]."','".$_POST ["txtResult1"]."','".$_POST["txtGroup1"]."','".$_POST["txtBoard1"]."','')";
if(mysql_query($sqlrss,$link)){
header("Location: Main.html");
}else {
header("Location: Error.php?msg=Insertion Failed");
在插入查询之后使用'echo mysql_error();'来调试错误。 –