chrisuk Posted November 5, 2007 Share Posted November 5, 2007 How do I do this? Usually I have a table and a while loop and do the standard procedure to make the table. However that's vertical - how can i do it for horizontal purposes? Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 5, 2007 Share Posted November 5, 2007 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"; ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 5, 2007 Share Posted November 5, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.