I want to fetch the last value generated from a query from database ,so I used following code.But I get 0 instead of the last value.So, please check this.I am new in PHP.Thanks in advance.
$feedbackStudentInfo="INSERT INTO `feedback_system_db`.`feedback_student_info` (`fs_id`, `batch_id`,`course`,`semester`, `section`, `feedback_session`)VALUES('','$feedBatchId','$course_id','$Current_Sem' ,'$Current_section',2014)";
$test2=mysqli_query($con,$feedbackStudentInfo);
$fsid=mysql_insert_id();
echo $fsid;
$feedbackStudentInfo="INSERT INTO `feedback_system_db`.`feedback_student_info` (`fs_id`, `batch_id`,`course`,`semester`, `section`, `feedback_session`)VALUES('','$feedBatchId','$course_id','$Current_Sem' ,'$Current_section',2014)";
$test2=mysqli_query($con,$feedbackStudentInfo);
$fsid=mysqli_insert_id($con); // Use mysqli_insert_id instead of mysql_insert_id
echo $fsid;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments