sql into 2 tables from one action (form)
| From: | Jeraimee Hughes | Date: | Wed, 28 Jun 2000 18:49:54 +0000 |
| Subject: | sql into 2 tables from one action (form) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-709@lists.php.net to get a copy of this message | ||
I need to take data (from a form) and have it INSERT into one table and
UPDATE another. When I run the code only the first query happens and no
error is produced. If I comment out one of the queries the other one runs.
Both queries do work - alone, but when put together only the first one runs.
Any suggestions?
--CODE:
// add data to tracking table
mysql_query("INSERT INTO changes (id_no,changed_to,program,time)
VALUES
('$dataWrong','$dataCorrect','$program',NOW(''))",$db)
or die("<br><b>Tracking Query Failed: Error 101</b>");
// change data in main db
mysql_query("UPDATE id_no SET id_no='$dataCorrect' WHERE
id_no='$dataWrong'",$db)
or die ("<br><b>Update Query Failed: Error 102</b>");