表单数据未插入数据库

时间:2019-07-15 00:02:22

标签: php parameters parameter-passing bind

需要帮助来确定问题所在。当我填写表单详细信息并单击Submit时,查询将按提交时执行,但数据库中未插入任何内容。主键已设置,因此自动递增。我没有关于如何调试它的想法。

我创建了另一个表并删除了前一个表,以便代码可以工作,但实际上不行。

<?php
session_start();
require('includes/config.php');
require('includes/checklogin.php');
check_login();
//code for registration
if(isset($_POST['submit']))
{
$regno=$_POST['regno'];
$fname=$_POST['fname'];
$mname=$_POST['mname'];
$lname=$_POST['lname'];
$ddob=$_POST ['dob'];
$gender=$_POST['gender'];
$mmas=$_POST['mas'];
$contactno=$_POST['contact'];
$rrel=$_POST['rel'];
$cstate=$_POST['state'];
$emailid=$_POST['email'];
$ssmoke=$_POST['smoke'];
$ddrink=$_POST['drink'];
$cchew=$_POST['chew'];
$course=$_POST['course'];
$ccyear=$_POST['cyear'];
$sspn=$_POST['spn'];
$sspcontact=$_POST['spcontact'];
$sspaddress=$_POST['spaddress'];
$sspemail=$_POST['spemail'];
$mmedical=$_POST['medical'];
$guardianName=$_POST['gname'];
$guardianRelation=$_POST['grelation'];
$guardianContactno=$_POST['gcontact'];
$ppcity=$_POST['pcity'];
$roomno=$_POST['room'];
$seater=$_POST['seater'];
$feespm=$_POST['fpm'];
$foodstatus=$_POST['foodstatus'];
$stayfrom=$_POST['stayf'];
$duration=$_POST['duration'];


$query1="insert into students(regno,firstName,middleName,lastName,ddob,gender,mmas,contatctno,rrel,corresState,emailid,ssmoke,ddrink,cchew,course,ccyear,sspn,sspcontact,sspaddress,sspemail,mmedical,guardianName,guardianRelation,guardianContactno,ppcity,roomno,seater,feespm,foodstatus,stayfrom,duration) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt1= $mysqli->prepare($query1);
$stmt1->bind_param('sssssssssssssssssssssssssssssss',$regno,$fname,$mname,$lname,$dob,$gender,$mas,$contact,$rel,$state,$email,$smoke,$drink,$chew,$course,$cyear,$spn,$spcontact,$spaddress,$spemail,$medical,$gname,$grelation,$gcontact,$pcity,$room,$seater,$fpm,$foodstatus,$stayf,$duration);
$stmt1->execute();
echo"<script>alert('Student Succssfully register');</script>";
$stmt1->close();
}
?>

我没有收到任何错误,并且执行了回显消息“ Student Succssfully register”,该消息告诉我代码没有问题。它为什么不插入数据库的原因

0 个答案:

没有答案
相关问题