Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting records into MULIPLE tables! 1

Status
Not open for further replies.

VitoCorleone

Programmer
Jun 22, 2004
28
GB
hello,

I have a form which i need to insert records into multiple tables. i am using $_POST to retrieve values from the previous page and have been using the following statement to insert into a single table

$dbQuery = "INSERT INTO staff (staff_no, fname, lname, position_, sex, dob, salary) VALUES ";

$dbQuery .= "('" . $_POST['staffno'] ."','" . $_POST['fname'] . "','" . $_POST['lname'] . "','" . $_POST['pos'] . "','" . $_POST['sex'] . "','" . $_POST['dob'] . "','" . $_POST['salary'] . "')";
mysql_query($dbQuery) or die("Couldn't add file to database");

if i wanted to insert $_POST{'branch'} into table branch which was also taken from the same form how should i go about this?

I have looked for infomation on multipe inserts on the web, butthere doesnt seem to be enough infomation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top