Hello,
I'm have image names stored in a databse and what i am trying to achieve is a better way of laying these out on my page. The code i am using to lay out two rows of 4 images is this
$sql = mysql_query("SELECT *
FROM images
WHERE property_code='$property_code'")
or die (mysql_error());
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n";
// Set initial value to zero
$cntrow = 0;
while ($row = mysql_fetch_array($sql)) {
$image_id=$row['image_id'];
$property_code=$row['property_code'];
$image_name=$row['image_name'];
// Determine value of $cntrow and print new row
if ($cntrow == 0) { echo "<tr>"; } if ($cntrow == 4) { echo "<tr>"; } if ($cntrow == 8) { echo "<tr>"; }
if ($cntrow == 2) { echo "<tr>"; } if ($cntrow == 4) { echo "<tr>"; }
// Print thumbnail
echo "<td><img src=\"photo_uploads/$image_name\" width=\"50\" height=\"50\" border=\"0\"</td>\n";
// Adds 1 to $cntrow variable
$cntrow = $cntrow + 1;
}
echo "</table>\n";
And i'm trying to modify it so that i have 1 large image in the top row and 4 smaller ones in the second row, but i keep ending up with duplicate images, does anyone know of a better way that i can manipulate how my images are displayed please.
Much appreciated.