Re: Extracting result - unknown number of fields
| From: | John W. Holmes | Date: | Thu, 14 Aug 2003 16:10:25 +0000 |
| Subject: | Re: Extracting result - unknown number of fields | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29891@lists.php.net to get a copy of this message | ||
Dillon, John wrote:
..but even if I can get the names and number of fields during 'run-time', how do I make the following statement applicable to a variable number of fields: while(list($a,$b...)= mysql_fetch_array($result)) or is there another way to extract which would work?$num_fields = mysql_num_fields($result); for($x=0;$x<$num_fields;$x++) { $field[$x] = mysql_field_name($result,$x); } Now $field is an array full of your column names. Adapt to your needs. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com