Saturday 10 September 2016

How to find ID of a new row added to a table or what is the usage of mysql_insert_id() ?


mysql_insert_id() function is useful to get the ID generated in the last query.
<?php
$query=mysql_query("INSERT into testtable VALUES('testvalue')");
$rowid = mysql_inser_id();
?>
$rowid contains the new row id.

No comments:

Post a Comment

Your comment is so valuable as it would help me in my growth of knowledge.