note 25509 added to function.extract
| From: | blistedus at rack1 dot php dot net | Date: | Thu, 26 Sep 2002 07:15:04 +0000 |
| Subject: | note 25509 added to function.extract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37268@lists.php.net to get a copy of this message | ||
If you're using extract with mysql_fetch_assoc, and only grabbing one line you can nestle it:
extract(mysql_fetch_assoc(mysql_query("SELECT * FROM table")));
If you're doing this in a while statement it will fail. Using something like...
$mysql_data = mysql_query("SELECT * FROM everywhere");
while (extract(mysql_fetch_assoc($mysql_data))) {
.. }
...will not work, while using...
while ($row = mysql_fetch_assoc($mysql_data)) {
extract($row);
...
}
...will. The only reason I find as an explination for this is annoyance.
--
http://www.php.net/manual/en/function.extract.php
http://master.php.net/manage/user-notes.php?action=edit+25509
http://master.php.net/manage/user-notes.php?action=delete+25509
http://master.php.net/manage/user-notes.php?action=reject+25509