Jump to content

Insert into multiple tables


harkly

Recommended Posts

I want to be able to insert my userID into multiple tables at one time if possible.

 

I thought I could do separate insert statements but its not working. Can someone point me in the right direction.

 

$sql = "INSERT INTO user 
	(userID, pswd, email, first_name, last_name, gender, bd_day, bd_month,
	 bd_year, birth_date, street, city, state, zip, signup_date)
  VALUES
	('$_POST[userID]','$_POST[pswd]','$_POST[email]','$_POST[first_name]','$_POST[last_name]',
	 '$_POST[gender]','$_POST[bd_day]','$_POST[bd_month]','$_POST[bd_year]','$_POST[birth_date]','$_POST[street]',
	 '$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[signup_date]')";


$aboutMe = "INSERT INTO about_me (userID)  VALUES ('$_POST[userID]')";
$pets = "INSERT INTO pets (userID)  VALUES ('$_POST[userID]')";
$appearance = "INSERT INTO appearance (userID)  VALUES ('$_POST[userID]')";

Link to comment
https://forums.phpfreaks.com/topic/184713-insert-into-multiple-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.