Forum Moderators: coopster
<?php
//connect to the database
$link = mysql_connect("localhost", "admin", "pass")
or die("Could not connect: " . msql_error());
mysql_select_db("gallery", $link)
or die (mysql_error());
$ImageDir = "/ballooncrew/gallery/centerpieces/";
$ImageThumb = $ImageDir . "/thumbs/";
$max_cols = 4;
?>
<html>
<head>
<title>Welcome to our Centerpeices Photo Gallery</title>
</head>
<body>
<p align="center">Click on any image to see it full sized.</p>
<table align="center">
<?php
echo "<tr>";
for ($i = 0; $i < $max_cols; $i+=1) {
echo " <td align=\"center\">Image</td>";
echo " <td align=\"center\">Caption</td>";
echo " <td align=\"center\">Date Uploaded</td>";
}
echo "</tr>";
?>
<tr>
<?php
$counter = 0;
//get the thumbs
$getpic = mysql_query("SELECT * FROM gallery_centerpieces")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
if ($counter % $max_cols == 0 && $counter!= 0) { echo "</tr><tr>\n"; }
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_caption . "</td>\n";
echo "<td>" . $image_date . "</td>\n";
//echo "</tr>\n";
$counter += 1
}
?>
</table>
</body>
</html>