Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Getting Next Autoindex
Old 05-22-2005, 06:43 PM Getting Next Autoindex
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
How in the name of cow do you get the next autoindex of a given table in a database, i know it can be done but the PHP Manual isnt helping and the SQL manual is terrible! Anyone have any idea at all?
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-22-2005, 07:05 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
oh no, figured it out.

Found that you can use LAST_INSERT_ID() to do what i needed, as i wanted to place the ID of something i had added into one table and place it in another related table.

Magic.
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 05-22-2005, 07:38 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
and if you want to get the last used ID from any table you can use;


SELECT LAST_INSERT_ID(auto_column) AS alias FROM table ORDER BY auto_column DESC LIMIT 1 ;
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-22-2005, 07:59 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
That's a good tip chrishirst, I wasn't aware of the last_insert_id() function. That could prove to be very handy.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Getting Next Autoindex
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.59130 seconds with 12 queries