Re: Can you l put a mysql statement in a while loop?
| From: | Dallas Kropka | Date: | Fri, 27 Oct 2000 08:55:46 +0000 |
| Subject: | Re: Can you l put a mysql statement in a while loop? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22278@lists.php.net to get a copy of this message | ||
Thats not gona do it.... you wont get your results like that.
what you need is this.
while(list($id,$v)=each($myarray))
{
$statement="UPDATE table SET value=$v WHERE id=$id;";
$result=mysql_query($statement);
}
----- Original Message -----
From: "Jan-Eric Duden" <duden@uwyo.edu>
To: "Shane McBride" <php@riversidedesigns.net>; "Php-General"
<php-general@lists.php.net>
Sent: Thursday, October 26, 2000 11:27 PM
Subject: Re: [PHP] Can you l put a mysql statement in a while loop?
> What about this here?
>
> $statement="";
> while(list($id,$v)=each($myarray))
> {
> $statement.="UPDATE table SET value=$v WHERE id=$id;";
> }
>
> $result=mysql_query($statement);
>
> Eric
>
> ----- Original Message -----
> From: "Shane McBride" <php@riversidedesigns.net>
> To: "Php-General" <php-general@lists.php.net>
> Sent: Thursday, October 26, 2000 9:19 PM
> Subject: [PHP] Can you l put a mysql statement in a while loop?
>
>
> I have an array that contains new values for a table. Can I use an
"update"
> statement in a while loop?
>
> I seems like a lot of overkill and waste of resources.
>
> Any better ideas (heck, ideas that will work would be cool).
>
> Nothing found elsewhere...
>
> TIA,
> Shane
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>