Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the next 'autoindex'. 1

Status
Not open for further replies.

perlone

Programmer
May 20, 2001
438
US
Is there anyway I can find the next autoindex integer using mySQL? Thank You.

-Aaron There is no Knowledge that is not power.
Age: 17
E-mail: projectnet01@yahoo.com
Company:(not done yet) :)
Status: Currently working with C++ for game developing. And making a musical band.
-Aaron
 
thank you! There is no Knowledge that is not power.
Age: 17
E-mail: projectnet01@yahoo.com
Company:(not done yet) :)
Status: Currently working with C++ for game developing. And making a musical band.
-Aaron
 
hi,

I was wondering if you could show me the right way. I tried this way:

$sql = select LAST_INSERT_ID() from news_index

It seems not working. Thank You again for your help. There is no Knowledge that is not power.
Age: 17
E-mail: projectnet01@yahoo.com
Company:(not done yet) :)
Status: Currently working with C++ for game developing. And making a musical band.
-Aaron
 
How can you tell that it isn't working? The correct query would be [tt]SELECT LAST_INSERT_ID()[/tt], you don't need the [tt]FROM ...[/tt] part of the query.

As a side note, if you are using PHP or any other language that has an interface the MySQL client library, then the function [tt]mysql_insert_id()[/tt] should be available. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top