Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004

    Unanswered: 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?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    "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 | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts