You are here: Re: printing collumn names then contents from mysql query « PHP Programming Language « IT news, forums, messages
Re: printing collumn names then contents from mysql query

Posted by monomaniac21 on 08/04/06 14:41

sorry had an urgent deadline with that one :-(

Rik wrote:
> monomaniac21 wrote:
>
> Do not toppost please.
>
> > Rik wrote:
> >> monomaniac21 wrote:
> >>> how can i take every field from a table (where there are many) and
> >>> without referencing by name (using a loop) echo there name in a td
> >>> followed by the contents? i think the foreach statement is what im
> >>> looking for? but i dont understand it.
> >> $result = mysql_query'$query);
> >> while($row = mysql_fetch_assoc($result){
> >> echo '<tr>';
> >> foreach($row as $key => $value){
> >> echo "<td>{$key}:{$value}</td>";
> >> }
> >> echo '</tr>';
> >> }
> > Ive tried that Rik and it deesnt work quite right. it displays each
> > collumn twice, once with a number as key and the value and again with
> > the (intended) colname as key and value. How can i modify it to stop
> > the first bit being output?
>
>
> Use mysql_fetch_assoc() as per my example instead of mysql_fetch_array();
>
> Grtz,
> --
> 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

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