How to get the auto incremented field after inserting to the database example. If a complaint is registered and the complaint id should be shown to the user.
$sql="INSERT INTO $tbl_name (cardno, comp, firno, compdate) VALUES ('$CardNo', '$Reason', '$Fir',CURDATE())";
mysql_query($sql);
I tried this but its showing only the 1st inserted record.
mysql_insert_id() returns the autoincrement id from the last query
But forget mysql, move into the 20th century and use mysqli (or even into the 21st century and use PDO)