Formatting Columns

Codes here !

Moderators: macek, egami, gesf

Post Reply
daveygz
New php-forum User
New php-forum User
Posts: 8
Joined: Mon May 28, 2012 6:39 am

Formatting Columns

Post by daveygz » Fri Nov 29, 2013 9:52 am

I haven't been working with PHP/MYSQL very long and I have a sorting issue. My code for displaying the data from my database is:

<?php
$queryFloor1 = "SELECT * FROM $table4 WHERE floor='Floor 1' ORDER BY size ASC";
$result = mysql_query($queryFloor1) or die(mysql_error());
$col_count = 0; // set up loop counter
echo '<table><tr>'; // start table and first tr
while ($row=mysql_fetch_array($result)) {
if ($col_count == 4) {
echo '</tr><tr>';
$col_count = 0;
}echo '<td style="width:200px;" align="left">'. "{$row['size']}".'&nbsp;-&nbsp;$'. " {$row['amount']}".'</td>';
$col_count++;
}
echo '</tr></table>';
?>


Get get my results but they are displayed across then down:
1 2 3 4
5 6 7 8

Is there a way to display them Down then across?
1 3 5 7
2 4 6 8

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest