Re: insert from selects
| From: | Ben Peter | Date: | Thu, 08 Jun 2000 14:33:10 +0000 |
| Subject: | Re: insert from selects | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-db+get-264@lists.php.net to get a copy of this message | ||
use mysql_affected_rows($db_link), it expects the link identifier that was
returned by mysql_connect(), not a result identifier.
On Sun, 6 Aug 2000, Chandrashekhar Bhosle wrote:
>
> hello,
> I have a query like,
>
> $sql = "INSERT INTO articles (title, author, intro, body, related,
> extra) SELECT title, author, intro, body, related, extra FROM art_queue
> WHERE aid='$aid'";
>
> $result mysql_query("$sql");
>
> It runs perfectly fine but I don't get either,
>
> 1.) number of affected rows by mysql_affected_rows($result) function.
> 2.) number of rows matched by mysql_num_rows($result) function.
>
> both say $result is not a valid MySQL Link identifier.
>
> how am I supposed to know if such queries of type
>
> "insert into (cols) select ... from"
>
> have done exactly what they were supposed to. that is, inserted and
> selected n number of rows.
>
> right now one can only get if query fails or succeeds from
> mysql_query().
>
> - cnb.
>
>
>
>
>
>
>
--
Benjamin Peter
Zentropy Partners GmbH
ph. +49-69-96244-395
pax +49-69-96244-244
http://www.zentropypartners.com
"Integrate the building and marketing of digital businesses"