note 23835 added to function.extract
| From: | zz123ty at hotmail dot com | Date: | Mon, 29 Jul 2002 21:55:43 +0000 |
| Subject: | note 23835 added to function.extract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33899@lists.php.net to get a copy of this message | ||
$query = "select one,two,three from table";
$res = mysql($dbname,$query);
echo mysql_error();
for ($i=0;$i<mysql_num_rows($result);$i++) {
extract(mysql_fetch_array($result),EXTR_OVERWRITE);
echo "$one, two, three";
}
//this will work for those, like myself, who have large databases and dont want to write
mysql_result($result,$i,one) over and over again. And it does it row by row automatically.
//Note that once you do an extract on an mysql array, and maybe regular arraries, it will destroy
the array.
//Also note that if you have multiple mysql arraries, you must call the extract for any particular
mysql array BEFORE you send another mysql query. The typical extract error will pop up if you
don't do this.
--
http://www.php.net/manual/en/function.extract.php
http://master.php.net/manage/user-notes.php?action=edit+23835
http://master.php.net/manage/user-notes.php?action=delete+23835
http://master.php.net/manage/user-notes.php?action=reject+23835