Php Programming Code Examples Php > Code Snippets Code Examples Add data to a MySQL database Add data to a MySQL database <?php // Do your insert query... mysql_query("INSERT etc..."); // This finds the id of the row once it has been added... $id = mysql_insert_id(); // Display it...echo $id;?>