Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert data into two tables using php and mysql

    Hi
    I have two tables called client and booking, the primary key in client table is clientID which is autoincress number and it’s a primary key, in the second table (booking) the primary key is bookingID and its autoincress number and the clientID is foren key.
    I have a questions:

    How could I get the clientID number from the first table and embedded to a Mysql querry to insert it with the other booking details i.e (arrival date, departure date,...) into the booking table.

    Any help will be highly appreciated ( I have read about the last_insert_id() but I don’t know how to use it an example will very good help).
    Kind Regards

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    http://php.net is your one-stop resource for "how do I" questions on specific PHP functions. The function you want to call is mysql_insert_id().

    http://us2.php.net/manual/en/functio...-insert-id.php


  •  

    Tags for this Thread

    Posting Permissions

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