RE: [PHP] PHP, MySQL & multiple commands??
| From: | John Holmes | Date: | Fri, 26 Jul 2002 01:27:34 +0000 |
| Subject: | RE: [PHP] PHP, MySQL & multiple commands?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109641@lists.php.net to get a copy of this message | ||
Can't do it. One SQL command per MySQL_query().
---John Holmes...
> -----Original Message-----
> From: Jason Caldwell [mailto:jason@thinkingman.org]
> Sent: Thursday, July 25, 2002 8:51 PM
> To: php-general@lists.php.net
> Subject: [PHP] PHP, MySQL & multiple commands??
>
> I'd like to be able to run a mysql_query() once while executing more
than
> one mysql command... for example:
>
> while($row = mysql_fetch_array($result))
> {
> $query_cmd = "INSERT INTO tblTest1 (number) VALUES (1);";
> $query_cmd .= "INSERT INTO tblTest2 (id, val)
VALUES(LAST_INSERT_ID,
> 'some data');";
>
> mysql_query($query_cmd);
> }
>
> When I run code similar to that listed above, I get a mysql error
"error
> at
> line 1." -- however, if I run the INSERTS separately -- no error.
>
> Is there a way I can run multiple commands within one string?
>
> Thanks
> Jason
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php