Re: Looping through the mysql_field_name function

From: Date: Sun, 02 Feb 2003 19:01:39 +0000
Subject: Re: Looping through the mysql_field_name function
References: 1  Groups: php.general php.windows 
Request: Send a blank email to php-general+get-134025@lists.php.net to get a copy of this message
On Sun, 2 Feb 2003, Davy Obdam wrote: > Hi ppl, > > I have a problem that probably very simple, but i cannot figure it out > right now.... > I need to get the field names of my database. I have a query like select > * from books and now i wanna have both the result and the field name. I > have been trying with mysql_field_name, but not succesfully... > > $i = 0; > for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) { > echo mysql_field_name($db->sqlResult, $i)."<br />"; > $i++; > } > > Can anyone help me please.. Your help is greatly appreciated;-) Please read the example in the manual as well as the user contributed notes. They show how to do this: http://www.php.net/mysql_field_name See also: mysql_num_fields() Regards, Philip

« previous php.general (#134025) next »