RE: [PHP-DB] sql into 2 tables from one action (form) STILL
| From: | Jason Stechschulte | Date: | Wed, 28 Jun 2000 21:07:29 +0000 |
| Subject: | RE: [PHP-DB] sql into 2 tables from one action (form) STILL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3666@lists.php.net to get a copy of this message | ||
This one doesn't make much sense to me. The only other thing I can think of
is you might be running the second query from within a function and
therefore don't have the variable $db. If this is the case, you will need
to pass $db or do a global $db; inside of the function. Other than that, I
can't help much without seeing more code.
Jason Stechschulte
jpstech@nc.edu
-----Original Message-----
From: Jeraimee Hughes [mailto:jlh@vantagetechnology.com]
Sent: Wednesday, June 28, 2000 5:03 PM
To: Jason Stechschulte
Subject: RE: [PHP-DB] sql into 2 tables from one action (form) STILL
>Not sure if this has anything to do with it, but the second query looks
>funny to me. Are the table name and the column name both id_no? And the
>other question I have is this. Are both the tables in the same database?
Yes and yes. The table name IS the same as the field name. Not much I can do
about it (inherited flaw) but so far it's worked rather well. Both tables
are in the same DB yes.
Thanks.
>-----Original Message-----
>From: Jeraimee Hughes [mailto:jlh@vantagetechnology.com]
>Sent: Wednesday, June 28, 2000 4:18 PM
>To: Php-Db List
>Subject: RE: [PHP-DB] sql into 2 tables from one action (form) STILL
>
>
>I was mistaken, it's still no good, current code is below. It
>still fails to
>run the second query. See previous e-mail (quoted below).
>
>--CODE:
> // add data to tracking table
>
>mysql_query("INSERT INTO changes (id_no,changed_to,program,time) VALUES
>('$dataWrong','$dataCorrect','$program',NOW(''))",$db);
>
> // change data in main db
>
>mysql_query("UPDATE id_no SET id_no='$dataCorrect' WHERE
>id_no='$dataWrong'",$db);
>
>>-----Original Message-----
>>From: php-db-return-709-jlh=vantagetechnology.com@lists.php.net
>>[mailto:php-db-return-709-jlh=vantagetechnology.com@lists.php.net]On
>>Behalf Of Jeraimee Hughes
>>Sent: Wednesday, June 28, 2000 2:50 PM
>>To: Php-Db List
>>Subject: [PHP-DB] sql into 2 tables from one action (form)
>>
>>
>>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>");
>>
>>
>>--
>>PHP Database Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>>For additional commands, e-mail: php-db-help@lists.php.net
>>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>For additional commands, e-mail: php-db-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>