note 37782 deleted from function.implode by didou
| From: | didou@php.net | Date: | Thu, 27 Nov 2003 07:05:39 +0000 |
| Subject: | note 37782 deleted from function.implode by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61018@lists.php.net to get a copy of this message | ||
Note Submitter: daevid@daevid.com
----
I can't take credit for this, but it is a true life saver for creating an update in a loop
structure...
while(list($column, $value) = each($FOO))
{
$upd[] = " $column = '$value'"; //this will loop until sql is built
}
$SQL = "UPDATE table set ".implode(',',$upd)." Where blah = 3 LIMIT
5"; //now do it
$result = mysql_query($SQL,$db);