Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 retrieve last inserted row

Author  Topic 

rajib
Starting Member

1 Post

Posted - 2010-06-08 : 01:53:16
Sir,
I created a table with Auto_incremented primary key. how can I retrieve last inserted row. I use PHP and mysql.

rajib

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-06-08 : 01:56:03
SQLTeam.com is on Microsoft SQL Server. Please post at dbforums.com for MySQL related question


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-06-08 : 02:28:16
quote:
Originally posted by rajib

Sir,
I created a table with Auto_incremented primary key. how can I retrieve last inserted row. I use PHP and mysql.

rajib



Use LAST_INSERT_ID().

i.e

After insert

Select LAST_INSERT_ID();

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -