Jump to content

dynamic tables that go horizontally instead of vertically?


chrisuk

Recommended Posts

Well, you didn't eally provide much details, but it's very simple:

 

<?php

echo "<table>\n";
echo "<tr>\n";

while ($record = mysql_fetch_assoc($result)) {
  echo "<td>" . $record['indexName'] . "</td>\n";
}

echo "</tr>\n";
echo "</table>\n";

?>

you can't easily do it in the while loop of a while($row = mysql_fetch);  what needs to happen is you store the data from this loop in the loop then build the table in a secondary loop

<?php
while($row = mysql_fetch_array($result)){
foreach($row as $key => $value){
$data[$key][] = $value;
}
//then build your data off this multi-dimenosonal array

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.