You are here: Re: Looping through fields in a row « PHP Programming Language « IT news, forums, messages
Re: Looping through fields in a row

Posted by Rik Wasmus on 09/14/07 13:42

On Thu, 13 Sep 2007 16:28:15 +0200, stacey <monkeymynd@gmail.com> wrote:=


> Hi All,
>
> I am trying to display a mysql record on the screen. I would rather
> not use specific field names in case the fields change, etc. So, I
> just want to create a simple table with the field names down the first=

> column and the corresponding values in the second. I've tried several
> different snippets of code that I found, but I can't seem to get it
> working right.
>
> This is what I've been working off of:
>
> $fieldNames=3Darray_keys($myrow);
>
> But this array have every other value as, what seems to be, a row id.
> Looks like this:
>
> Array ( [0] =3D> 0 [1] =3D> sheet_id [2] =3D> 1 [3] =3D> client_id [4]=
=3D> 2
> [5] =3D> business_name [6] =3D> 3 [7] =3D> business_address [8] =3D> 4=
[9] =3D>
> business_city)

Don't fetch the result with mysql_fetch_array(), use mysql_fetch_assoc()=
=

instead. mysql_fetch_array() will return both a numerical as named array=
=

by default.
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация