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]
|