On Android when i Insert a row to my database, i can easily get its Id after it's inserted :
long id=database.insert(MySqlHelper.TABLE_UPLOAD, null,values);
Is there a similar PHP
function to retrieve the Primary key
of the Inserted row, without using another Select statement, just Like Android
?
Yes, there is:
mysql_insert_id
, see http://php.net/manual/en/function.mysql-insert-id.phpIf you use MySQLi:
mysqli_insert_id
, see http://www.php.net/manual/en/mysqli.insert-id.phpIf you use PDO:
PDO::lastInsertId
, see http://www.php.net/manual/en/pdo.lastinsertid.php