Forgot the code in last post...
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Location where the images are stored
$file_path = 'http://www.mysite.com/holidays/files/photo_big/';
$sql = mysql_query("SELECT photo_id, photo_caption_1, photo_listing
FROM listing_photo
WHERE photo_listing = 127
ORDER BY `photo_status_main` <> 'main'
LIMIT 10");
if (mysql_num_rows($sql) > 0) {
// Default numver of columns
$num_cols = 2;
while ($row = mysql_fetch_array($sql)) {
$items[] = array('photo_id' => $row['photo_id'], 'photo_caption_1' => $row['photo_caption_1']);
}
// Number of items in the array
$num_items = count($items);
// Number of rows
$num_rows = ceil($num_items / $num_cols);
// Begin HTML table
echo '<table width="75%">';
for ($row = 1; $row < $num_rows; $row++) {
$cell = 0;
// Start each new row
echo '<tr>';
for ($col = 1; $col <= $num_cols; $col++) {
echo '<td>';
if ($col === 1) {
$cell += $row;
echo '<div class="Image"><img src="'. $file_path . $items[$cell - 1]['photo_id'] .'.jpg" alt="'. $items[$cell - 1]['photo_caption_1'] .'" title="'. $items[$cell - 1]['photo_caption_1'] .'" />';
echo '<br />';
echo '<span><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000">'. $items[$cell - 1]['photo_caption_1'] .'</font></span></div>';
}
else {
$cell += $row;
echo '<div class="Image"><img src="'. $file_path . $items[$cell - 1]['photo_id'] .'.jpg" alt="'. $items[$cell - 1]['photo_caption_1'] .'" title="'. $items[$cell - 1]['photo_caption_1'] .'" />';
echo '<br />';
echo '<span><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000">'. $items[$cell - 1]['photo_caption_1'] .'</font></span></div>';
}
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
}
?>