note 19151 added to ref.mysql

From: Date: Mon, 18 Feb 2002 09:44:24 +0000
Subject: note 19151 added to ref.mysql
Groups: php.notes 
Request: Send a blank email to php-notes+get-26731@lists.php.net to get a copy of this message
I find it the least problematic to simply use the list() construct to assign variables from an array returned from the mysql_fetch_row() & others. $data = mysql_query("SELECT name, data FROM table"); while(list($t_name, $t_data) = mysql_fetch_row($data)) { echo "Name: $t_name Data: $t_data\n"; } It's not too difficult to maintain something like this, since the list() variables mirror the fields being queried. It gets messy when you have more than 10 fields you are working with. -- http://www.php.net/manual/en/ref.mysql.php http://master.php.net/manage/user-notes.php?action=edit+19151 http://master.php.net/manage/user-notes.php?action=delete+19151 http://master.php.net/manage/user-notes.php?action=reject+19151

« previous php.notes (#26731) next »