If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Get the id before inserting the record?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-27-07, 12:27
subnet_rx subnet_rx is offline
Registered User
 
Join Date: Oct 2004
Posts: 6
Get the id before inserting the record?

Probably not as complex as it sounds, but basically when someone fills out a form, I'd like to give that group of fields it's own id. So, it would have a group id, and then each item would have that group id associated with it. How do you do that in MySQL?
Reply With Quote
  #2 (permalink)  
Old 08-27-07, 15:22
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
"that group of fields" ???

if each field has the same groupid, are you then inserting them as individual items? with some other number as their primary ids?

kinda lost here

however, based on what you said, i would create an entry in the groups table, give it a new name and/or description, grab the id from that after it was inserted (using LAST_INSERT_ID function), and then use this for all your for field item inserts
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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