954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

MySQL: Knowing the ID of a new record

Hello everybody.
I've created a PHP page that adds a new record to a table. I want to know what's the ID of that created record in that table.
For example:

mysql_query("insert into tableName(field_A,field_B) values('valueA','valueB')");
Pro2000
Posting Whiz
351 posts since Jun 2007
Reputation Points: 44
Solved Threads: 23
 

You can use mysql_insert_id() function.
refer http://php.net/manual/en/function.mysql-insert-id.php

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

Thank you very much.. That's exactly what I want.

Pro2000
Posting Whiz
351 posts since Jun 2007
Reputation Points: 44
Solved Threads: 23
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: