Hey folks,
I'm having a bit of trouble getting a while loop to work whilst it is producing a table. The problem would be relatively easy to resolve if I was trying to produce lot's of table rows, but instead I'm trying for numerous table columns with only two rows.
The outcome should look like this (when 7 different villa's exist):
but actually look's like this, once the while loop is introduced:
The actual code for the while loops is:
I can't figure out how to create the table with it only every using 2 rows, as for what I have now it is producing a new row for every new villa that it finds.
Hopefully someone can figure it out , as I can't!
Thanks for any help given,
Steven.
I'm having a bit of trouble getting a while loop to work whilst it is producing a table. The problem would be relatively easy to resolve if I was trying to produce lot's of table rows, but instead I'm trying for numerous table columns with only two rows.
The outcome should look like this (when 7 different villa's exist):
.png)
but actually look's like this, once the while loop is introduced:
.png)
The actual code for the while loops is:
Code:
echo "<table border='0' cellpadding='0' cellspacing='4'><tr>";
while($villa = mysql_fetch_array($villas))
{
$villaid = $villa['villaid'];
$thumbnail = $villa['thumbnail'];
$categoryid = $villa['categoryid'];
//$villaid = htmlspecialchars($villa['villaid']);
$thumbnail = htmlspecialchars($villa['thumbnail']);
$categoryid = htmlspecialchars($villa['categoryid']);
echo "<td class='villas-top'><a href='index.php?page=villapage&villaid=$villaid'><img src='$thumbnail' /></a></td></tr>".
"<tr><td class='villas-bottom'>$categoryid Bedrooms</td>";
}
echo "</tr></table>";
I can't figure out how to create the table with it only every using 2 rows, as for what I have now it is producing a new row for every new villa that it finds.
Hopefully someone can figure it out , as I can't!
Thanks for any help given,
Steven.