Jump to content


Photo

Finding ID of value entered


  • Please log in to reply
2 replies to this topic

#1 chico1st

chico1st
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 11 August 2006 - 02:24 AM

Hey i was wondering if there is a way to know the ID (auto_assigned primary key) of a value you just input.
The only way I can think of... unless there is a command... is to just go through the whole table and note the very last ID.
Any help would be great!
THANKS!

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 11 August 2006 - 03:01 AM

http://ca.php.net/ma...l-insert-id.php
Legend has it that reading the manual never killed anyone.
My site

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 11 August 2006 - 04:04 PM

That is, "SELECT LAST_INSERT_ID()".
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users