hmmm.... what if you fetch the data from columns in the table and insert the data into arrays, ie get the whole image column into image array, name column into name array and description column into description array, then write it out three sets at a time, first numbers 1, 2 and 3 for image, then for name and then for description, and so on.
i seem to be recommending loops a lot these days, but i think your case could benefit from using a loop.
$rows = numberOfRowsInTheTableDividedByThree;
for($counter = 1; $counter <= $rows; $counter + 3)
{
$left = $counter;
$middle = $counter + 1;
$right = $counter + 2;
echo "<tr>"
echo "<td>" . $image[$left] . "</td>";
echo "<td>" . $image[$middle] . "</td>";
echo "<td>" . $image[$righ] . "</td>";
echo "</tr>"
echo "<tr>"
echo "<td>" . $name[$left] . "</td>";
echo "<td>" . $name[$middle] . "</td>";
echo "<td>" . $name[$right] . "</td>";
echo "</tr>"
echo "<tr>"
echo "<td>" . $description[$left] . "</td>";
echo "<td>" . $description[$middle] . "</td>";
echo "<td>" . $description[$right] . "</td>";
echo "</tr>";
}
unless i've really misunderstood you, this should be what you're looking for.
now all you need to do is pour it into a bowl, add a <table> tag and </table>, mix in some MySQL queries and bake for a few moments.
hope you like it!
grimmy
God, grant me the serenity to accept the things I cannot change, the courage to change the things I can, and the wisdom to hide the bodies of those people I had to kill because they pissed me off.
|