note 16464 deleted from function.each by irc-html

From: Date: Sat, 19 Jan 2002 21:53:29 +0000
Subject: note 16464 deleted from function.each by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25496@lists.php.net to get a copy of this message
I was faced with typing out an SQL UPDATE statement that would have over 100 fields to update... Thanks to the each() function, It saved me stacks of time! Here is my update function now, based on the $HTTP_POST_VARS example near the top. reset ($HTTP_POST_VARS); while (list ($key, $val) = each ($HTTP_POST_VARS)) { $sql = "UPDATE product SET $key='$val' WHERE prod_id='$prod_id'; $qu = mysql_query($sql) or die(mysql_error()); }

« previous php.notes (#25496) next »