Re: two inserts at once?
| From: | Ignatius Reilly | Date: | Thu, 09 Jan 2003 17:19:40 +0000 |
| Subject: | Re: two inserts at once? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24704@lists.php.net to get a copy of this message | ||
If you are using MySQL, you can't.
(none of my business, but why not simplifying your table names: "faqProduct"
instead of "faqRelatedToProduct" ?)
Ignatius
____________________________________________
----- Original Message -----
From: "Michael Knauf/Niles" <mknauf@nilesaudio.com>
To: <php-db@lists.php.net>
Sent: Thursday, January 09, 2003 6:04 PM
Subject: [PHP-DB] two inserts at once?
> 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[ë®Å
> Pœ”K*úë
, fgNumber, faqId) VALUES
> ('',
> '$fgNumber', '$faqid');
>
> So that both are executed at the same 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...
>
> Is there a way to combine the two queries?
>
> Michael
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>