Re: name of field
| From: | Sheridan Saint-Michel | Date: | Fri, 28 Sep 2001 14:41:56 +0000 |
| Subject: | Re: name of field | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12820@lists.php.net to get a copy of this message | ||
May I ask why you don't want to use mysql_fetch_array?
mysql_fetch_row isn't significantly faster and for what you
want to do this:
$result=mysql_query($sql,$conn);
$row=mysql_fetch_array($result,MYSQL_ASSOC);
while (list ($key, $val) = each ($row))
{
echo "$key => $val<BR>";
}
would be both easier and faster than doing mysql_fetch_row
and then making multiple calls to mysql_field_name.
Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com
----- Original Message -----
From: "Attila Strauss" <shortys@gmx.li>
To: <php-db@lists.php.net>
Sent: Friday, September 28, 2001 6:59 AM
Subject: Re: [PHP-DB] name of field
>
> http://www.php.net/manual/en/function.mysql-field-name.php
>
> Best regards
> Attila Strauss
>
>
>
> > how can i get the name of fields in a record
> >
> > $result=mysql_query($sql,$conn);
> > $row=mysql_fetch_row($result);
> > $record_length=count($row);
> > for($i=0;$i<$record_length;$i++)
> > {
> >
> > // here i wanna echo the field name
> > echo $row[$i];
> > }
> >
> >
> >
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net