On Thu, 28 Aug 2003 16:37:41 +0200
Fred van Engen <[EMAIL PROTECTED]> wrote:
> Please elaborate.
I've already answered:
On Thu, 28 Aug 2003 17:07:19 +0400
Antony Dovgal <[EMAIL PROTECTED]> wrote:
> You don't need execute UPDATE's in the loop in this case.
> Try smthing like that:
> <?
> .....
>
> $ids = Array();
> while ($row = mysql_fetch_assoc($result1))
> {
> $ids[] = $row["id"];
> }
>
> $ids_string = implode(',',$ids);
>
> //of course, we need to check if $id_string is not empty
>
> $q2 ="UPDATE table SET review = 1 WHERE id IN (".$ids_string.")";
>
> .....
> ?>
there is no need to use nested loop at all.
just collect id's and execute 1(one) query, which will update all records.
and you don't need to make another one connection, of course.
---
WBR,
Antony Dovgal aka tony2001
[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]