multiple queries in the same "request"
| From: | Gabriel B. | Date: | Mon, 20 Jun 2005 13:18:00 +0000 |
| Subject: | multiple queries in the same "request" | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39710@lists.php.net to get a copy of this message | ||
I have a table with some relational values, that really saves me on
selects, but gives me a weird error in the insert...
in the DB i have this 2 tables data and categories:
data(
id int
category tinyint ),
categories (
id tinyint
description varchar )
for selects i can use a single query with a left join.
but to populate the table without having to use "magic numbers" in my
code i've come up with:
SELECT (@category_id:=id) FROM categories WHERE description = "cat1";
REPLACE INTO data VALUES( 10, @category_id);
i send this as a single query in PHP and it returns an error quoting
everything after the first ";"
anyidea if i can't send several queries at once? any workaround?
Thanks,
Gabriel