0

I'm new to PHP and I'm some trouble writing to multiple tables from the same form. When I run the following script it will not write the data to XINFO but it will write to ATTRIB1. If I take ATTRIB1 out of the script it will work properly and once again write to XINFO. I can't figure out what I'm doing wrong. Any help would be greatly appreciated.

// Insert fields into XINFO 
	 $sql = "INSERT INTO xinfo SET
	 
first_name='$fn',
last_name='$ln',
city='$city',
state_province='$state',
country='$cntry',
other_country='$ocntry',
dob='$dob',
email='$em' ";

// Insert fields into ATTRIB1
	$sql = "INSERT INTO attrib1 
	
example='$x1' ";
2
Contributors
2
Replies
5
Views
8 Years
Discussion Span
Last Post by CFROG
0

You are overwriting your $sql variable with the second statement. Try running the first SQL statement before you set the $sql variable, or you could change your second statement to use a new variable, for example $sql2.

0

Thanks darkagn. A quick $exec = mysql_query() between statements did the trick.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.