Posted by monomaniac21 on 08/04/06 09:40
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?
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>';
> }
>
> Grtz,
> --
> Rik Wasmus
Navigation:
[Reply to this message]
|