You are here: Re: Get the name of the column 2 « PHP Programming Language « IT news, forums, messages
Re: Get the name of the column 2

Posted by Rik Wasmus on 10/30/07 23:14

On Tue, 30 Oct 2007 23:54:34 +0100, Jorge Reyes <jorg_reyes@hotmail.com>=
=

wrote:

> Wow this is very very useful believe me, at least for me, but i have
> two more questions, i have the next code:
>
> while($row =3D sybase_fetch_assoc($result)) {
> while(current($row)) {
> $key =3D key($row);
> $data =3D current($row);
> print ("<br>".$key."<br>".$data);
> next($row);
> }
> }
> and i have a raw data like
>
> Col1 Col2 Col3
> ----------------------------------------------------------------------=
-----------
> 24/10/2007 07:30:52.000 PM 0 CENTRO
>
> then the result is:
>
> Col1
> Oct 24 2007 7:30PM
> Col3
> CENTRO
>
> so, question number 1) how can i do to preserve the original date
> format (dd/mm/yyyy hh:mm:ss AM/PM

Well, show the query, normally database queries will return the stuff in=
=

the original format unless you ask otherwise. If your database doesn't, =
=

see it's documentation for handling date/time columns and formatting =

possibilities.

> 2) and most important, who can i do because when Col2 is 0 it is not
> showed in the result but i want to show it

Just use an foreach($row as $key =3D> $data)( echo "<br>".$key."<br>".$d=
ata; =

} instead of the inner while.
-- =

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

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