Re: two inserts at once?
| From: | Jason Wong | Date: | Thu, 09 Jan 2003 18:08:22 +0000 |
| Subject: | Re: two inserts at once? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24713@lists.php.net to get a copy of this message | ||
On Friday 10 January 2003 01:04, Michael Knauf/Niles wrote:
> This Code Snippet works:
>
> $newfaq_query = "INSERT INTO
faq
> (faqid, question,
> answer) VALUES
> ('', '$question', '$answer')";
> $newfeaturesResult = mysql_query($newfeatures_query);
>
> But I'd like to combine that query with this one:
>
> INSERT INTO faqRelatedToProduct
> (id, fgNumber,
> faqId) VALUES ('',
> '$fgNumber', '$faqid');
>
> So that both are executed at the same time.
The current php-mysql interface only allows single queries at a time.
> The variables $question, $answer, $fgNumber come from a form, the faqid is
> a auto increment field, as is id... but it seems I need to know the value
> of faqid to relate it correctly to the fgNumber...
The retrieve faqid use mysql_insert_id().
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
The more you sweat in peace, the less you bleed in war.
*/