Jump to content

pseudomega

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pseudomega's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yep, that did it.  Here's the code I ended up with: [code]$owner = "INSERT INTO owners (owner_name) " . "VALUES ('$owner_name')"; $owner_results = mysql_query($owner) or die(mysql_error()); $owner_id = mysql_insert_id(); echo "Owner data inserted successfully!<br /><br />"; echo "Inserted $owner_name into the database with ID# $owner_id<br /><br />"; $store = "INSERT INTO stores (store_type, store_owner, store_state, store_zip, store_phone, store_status, store_comments) " . "VALUES ('$store_type', '$owner_id', '$store_state', '$store_zip', '$store_phone', '$store_status', '$store_comments')"; $store_results = mysql_query($store) or die(mysql_error()); echo "Succsessfully stored $owner_name's store in the database.";[/code] Thanks a bunch!
  2. This is my current INSERT statement which uses POST'ed data from an HTML form: [code]$store = "INSERT INTO stores (store_type, store_state, store_zip, store_phone, store_status, store_comments) " . "VALUES ('$store_type', '$store_state', '$store_zip', '$store_phone', '$store_status', '$store_comments')"; $owner = "INSERT INTO owners (owner_name) " . "VALUES ('$owner_name')";[/code] The 'owners' table has an auto incrementing 'owner_id'. I have a 'store_owner' row in the 'stores' table that I would like to insert the 'owner_id' into.  Is there a way to grab that value as it is being generated?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.