Jump to content

[SOLVED] Get the id after "INSERT INTO DATABASE" command


rahul.pache

Recommended Posts

I am using php and mysql

 

I want to insert some data in database.

 

Database is

id (primary key, auto increment)  |  email address  |  password

 

I insert data like

$query1 = "insert into DatabaseName values(NULL, '[email protected]', 'Tony  ...... ')";

then execute the query

 

BUT I want to retrieve the ID which has been just set for inserted data.

 

Please suggest me the optimal solution.....

(I don't want to search again for the data inserted and get its id.)

 

Is there any direct solution for doing this

 

 

Plz help I will be thankfull.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.