I'm trying to create an INSERT statement that will change a field in one
table based upon the id defined in another table.

Here is what I tried:

$sql1 = "INSERT INTO $table_name1 (FirstName,LastName,WorkPhone,
HomePhone,EmailName,Birthday)
VALUES
('[$FirstName]','[$LastName]','[$WorkPhone]','[$HomePhone]','[$EmailName]','
[Birthday]')
";


$sql2 = "INSERT INTO $table_name2 (CompanyName,WebSite)
VALUES
('[$CompanyName]','[$WebSite]')

WHERE contacts ON company.CompanyID =
contacts.CompanyID WHERE ContactID='$ContactID'
";

 $result_1 = @mysql_query($sql1,$connection) or die("Couldn't execute
query.");
 $result_2 = @mysql_query($sql2,$connection) or die("Couldn't execute
query.");
 ?>

The goal is based upon a unique field call ContactID I want to be able to
update the CompanyName associated with the ContactID.

For example: ContactID=1 might have an associated CompanyName= Smith, Inc.
What I want to do is UPDATE/INSERT a new CompanyName and have that reflected
by changing the CompanyID associated with the ContactID.





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to