Код:
<?php
//connect to the database
$link = mysql_connect("localhost", "root", "")
or die("Could not connect: " . msql_error());
mysql_select_db("reklama", $link)
or die (mysql_error());
$ImageDir = "images";
$ImageThumb = $ImageDir . "/thumbs/";
?>
<html>
<head>
<title>Welcome to our Photo Gallery</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<link href="advert_styles.css" rel="stylesheet" type="text/css">
</head>
<body >
<p align="center"></p>
<table align="center" border="3" bordercolor="#000000" width="500">
<tr>
<td align="center" width="100">Image</td>
<td width="107" align="center">Message</td>
<td width="106" align="center">By</td>
<td width="155" align="center">Date Uploaded</td>
</tr>
<?php
//get the thumbs
$getpic = mysql_query("SELECT * FROM advert_post")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $advert_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $advert_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $advert_message . "</td>\n";
echo "<td>" . $advert_user . "</td>\n";
echo "<td>" . $advert_date . "</td>\n";
echo "</tr>\n";
}
?>
</table>
</body>
</html>