我有更新学生记录的代码。
$select_query="select student_id from student_information where student_id = '$student_id'";
$result_set = mysql_query($select_query,$link_id);
if($row = mysql_fetch_array($result_set)){
$flag="exists";
header("location:Admin_Home.php?flag=$flag&student_id=$student_id");
die();
}
else{
/*
This block is used to insert the learners record in database
if the student_id is not yet registered in the database.
*/
mysql_query("SET AUTOCOMMIT = 0 ");
if(mysql_error() != null){
die(mysql_error());
}
$query = "insert into student_information(student_id,student_password,first_name,last_name,registration_date,gender,date_of_birth,";
$query .= "contact_no,grade,section,LRN,email1,email2,address,description,learner_id)";
$query .= " values('$student_id','$student_password','$first_name','$last_name',now(),'$gender','$date_of_birth',";
$query .= "'$contact_no','$grade','$section','$LRN','$email1','$email2','$address','$description','$learner_id')";
$result = mysql_query($query,$link_id);
if(mysql_error() != null){
die(mysql_error());
}
}
现在,我的问题是放置一个脚本,提醒“记录已更新”,并插入此代码的哪一部分。 请指教。
答案 0 :(得分:1)
改变这个:
if(mysql_error() != null){
die(mysql_error());
}
对此:
if (mysql_error() != null) {
die(mysql_error());
}
echo "Records updated.";