...

View Full Version : Insert data into two tables using php and mysql



hb25
02-26-2009, 06:07 PM
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

Fumigator
02-26-2009, 11:48 PM
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/function.mysql-insert-id.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum