![]() |
Webmaster Forum Rules | Posting Guide | Contact Us | Testimonials | Contributing Geek Program | Advertise on Geek/Talk |
|
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 |
Join Date: Aug 2000
Location: CA USA
Posts: 484
|
![]()
I have my MYSQL table's primary key set so that it auto increments (meaning it goes up on it's own). If I insert a new row, does anyone know how to find out what it's automatically generated primary key is going to be?
That was a confusing question...it's all right if nobody understands. |
![]() |
![]() |
![]() |
#2 |
Registered User
Join Date: Feb 1999
Location: Kaysville, UT
Posts: 958
|
![]()
Here's one way to do it in PHP:
First grab the last ID from the row you inserted: PHP Code:
PHP Code:
Does that help? |
![]() |
![]() |
![]() |
#3 |
Registered User
Join Date: Feb 1999
Location: Kaysville, UT
Posts: 958
|
![]()
err.. Maybe I mis-understood you
![]() If you mean what the number assigned to it will be, ignore the second part, the $lid = .... part gives you the Key assigned to it. |
![]() |
![]() |
![]() |
#4 |
Join Date: Aug 2000
Location: CA USA
Posts: 484
|
![]()
EXACTLY what I wanted, thanks a lot spencer!
|
![]() |
![]() |
![]() |
Bookmarks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
MySQL MUL key / duplicate error | dwergs | Web Development - Programming / Coding | 5 | 06-05-2002 07:05 AM |
MySQL installation problems. | b2gdotcom | Web Development - Programming / Coding | 3 | 11-29-2001 04:00 AM |
Tip for heavy MySQL users: CREATE INDEX | demae | Web Hosting Discussion | 4 | 05-15-2001 04:32 PM |
vBullletin - Corrupted MySQL records! | Steve_S | Web Design and Webmaster Issues | 5 | 02-07-2001 12:44 AM |
mysql overload? | notibrian | Web Design and Webmaster Issues | 0 | 02-01-2001 09:03 PM |