A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: return an id field to php after SQL INSERT command?

  1. #1

    return an id field to php after SQL INSERT command?

    Hi guys,

    I was wondering if it is possible to return the id field of a record which has just been inserted using the SQL INSERT command? At the moment I have to then run another query to get the id field of the record I have just inserted.

    Basically I have two tables

    1.customers
    2.address_book

    I want to INSERT INTO customers all the customers details....

    then I want to INSERT INTO address_book the customers address and the customers_id field which is the foriegn key.

    At the moment I have to run another query on the customers table to get the customers_id for the record I have just inserted.

    Is there a way SQL could return this info to me without having to do another query?

    thanks,

    grandmasterC

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039

  3. #3
    Thanks Musicman,

    You rock! Once again you have saved me a lot of headaches.

    Cheers,

    granmasterC

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center