Current location: Hot Scripts Forums » Programming Languages » PHP » An easy MySQL question...I think


An easy MySQL question...I think

Reply
  #1 (permalink)  
Old 07-28-04, 12:08 AM
kvnband kvnband is offline
Wannabe Coder
 
Join Date: Jun 2003
Posts: 242
Thanks: 0
Thanked 0 Times in 0 Posts
An easy MySQL question...I think

OK, please don't call me stupid Remember, I'm learning

I'm inserting this data into a database

name, number, time, trip, confirm (auto increment)

Question: I want to pull the confirm number DIRECTLY after I store it in the database. is there any way to do this without running another query?

I ask this, because if I say select confirm from sunday where name=joe and number=2225556358, and joe has more than one entry, and then I display it, it displays joe's first order. I don't care what joe ordered before, I just want to print his confirm number right after he orders.

Anybody understand my rambling just now?

Kevin
Reply With Quote
  #2 (permalink)  
Old 07-28-04, 11:50 AM
infinitylimit's Avatar
infinitylimit infinitylimit is offline
Code Guru
 
Join Date: Jun 2004
Location: Oregon
Posts: 758
Thanks: 0
Thanked 0 Times in 0 Posts
confirm should be the primary key and you should be able to use mysql_insert_id() to find out what it was. www.php.net/mysql_insert_id
__________________
Hawk Enterprises -- Home to PHP games, open-source code, tutorials and free downloads
Reply With Quote
  #3 (permalink)  
Old 07-28-04, 06:47 PM
kvnband kvnband is offline
Wannabe Coder
 
Join Date: Jun 2003
Posts: 242
Thanks: 0
Thanked 0 Times in 0 Posts
As always, your expertise is amazing

Thanks,
Kevin
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL question Need Help With something! bearslife PHP 1 05-20-04 09:22 AM
question about updating a page or database for an, php and mysql updating mikewooten PHP 1 02-12-04 12:11 AM
mySQL question Isaac16 PHP 6 01-12-04 07:19 PM
PHP to MySQL script question...(using a field to update info in MySQL) DisneyFan25863 PHP 4 11-02-03 03:31 AM
MySQL with PHP question. HELP for a newbie kenfused PHP 3 08-02-03 12:53 AM


All times are GMT -5. The time now is 04:15 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.