Re: Extracting result - unknown number of fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux