Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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