Hi guys please help me with my script. I'm arraying the result of my query so it will show in order. In this script I'm trying to make the looping in a table, so it will do three columns to right frist and then doing it into rows. (I'm sorry if my english bad).
Here's my script:
$arai=array();
$columns=3;
$rows=ceil(mysql_num_rows($db->sql_result)/$columns);
for ($x = 1; $x <= $columns; $x++)
for ($y =1; $y <= $rows; $y++)
$arai[$x][$y]=mysql_fetch_array($db->sql_result);
echo "<table border='0' cellspacing='5' cellpadding='0'>";
for ($y =1; $y <= $rows; $y++) {
echo "<tr>";
for ($x = 1; $x <= $columns; $x++)
if (isset($arai[$x][$y]['img_name']))
echo "<td align='center' valign='top'><img src='gallery/thumbs/".$arai[$x][$y]['img_name']."' border='0'></td>";
else
echo "<td align='center' valign='top'> </td>";
echo "</tr>\n";
}
echo "</table>\n";
with this script everything going fine, but the looping doing like this
| A | C | E |
| B | D | F |
what i like to have is looping in right order like this
| A | B | C |
| D | E | F |
Please help me.
Thanks in advance guys 🙂