International Electronics and Technology Forum
May 17, 2012, 04:35:08 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Send data to two tables in mysql using PHP?  (Read 193 times)
Fernando_Eizenberg
Newbie
*
Posts: 1


« on: July 15, 2011, 03:18:31 AM »

How do i use the two queries? I am using mysql_select_db() to send information into two tables. Please be as specific as possible.

$sql="INSERT INTO Client_Info (Gender, Sexual_Orientation, Race_Ethnicity, Gender_Presentation, Body_Type, Height, Weight, Felony_Conviction) VALUES
 ('$_POST[pleaseindicateyourgender]','$…

 $sql="INSERT INTO Lifestyle (Employment, Occupation, Education_Achieved, Children, Pets, Drink, Smoke) VALUES ('$_POST[employed]','$_POST[occupation]'…
 
if (!mysql_query($sql,$con))
 {
 die('Error: ' . mysql_error());
 }
 echo

header("Location: http://my.website.com");
 exit();
 mysql_close($con)
 ?>
 
I keep receiving an error message Parse error: syntax error, unexpected T_STRING in /home/a992/public_html/clientinfo1insert… on line 21
 
How do I send the two queries successfully to their respective tables?
Logged
Yanni_Depp
Newbie
*
Posts: 4


« Reply #1 on: July 19, 2011, 01:37:29 AM »

By using a . to join strings
Logged
Rolland_Bennett
Newbie
*
Posts: 2


« Reply #2 on: July 19, 2011, 12:21:04 PM »

create relationship and insert both table.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC | Privacy Policy Valid XHTML 1.0! Valid CSS!