Hi,
I am having a small problem and I hope someone can help me. My gallery as 50 records in it but if someone goes to 51 it shows a blank page does anyone know how to get it to go to the homepage if they enter an id that dont exist. this is the code I am using.
$id = intval($id);
$result = mysql_query("SELECT hits, name, clickurl, downloadurl, format, description, date, size FROM my_gallery WHERE id='$id' AND active='1'");
while ($row = mysql_fetch_array($result)) {
$hits = intval($row['hits']);
$name = $row[name];
$clickurl = $row[clickurl];
$downloadurl = $row[downloadurl];
$format = $row[format];
$description = $row[description];
$date = $row[date];
$size = intval($row['size']);
mysql_query("UPDATE my_gallery SET hits=hits+1 WHERE id='$id'");
echo "<table width=\"75%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n";
echo "<td align=\"center\" width=\"100%\"><div align=\"center\" class=\"cat\"><font class=\"cattitle\">$name</font></div></td></table>\n";
echo "<table width=\"75%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n";
echo "<td align=\"center\" width=\"50%\" class=\"row1\" valign=\"top\"><font class=\"forumlink\">"._GALLERY_ADDED." : $date<br>"._GALLERY_FORMAT." : $format</font></td><td align=\"center\" width=\"50%\" class=\"row1\" valign=\"top\"><font class=\"forumlink\">"._GALLERY_SIZE." : $size KB<br>"._GALLERY_HITS." : $hits</td></table>\n";
echo "<table width=\"75%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n";
echo "<td align=\"center\" width=\"100%\" class=\"row1\" valign=\"top\"><font class=\"forumlink\">"._GALLERY_DESCRIPTION." : $description</font></td></table>\n";
if ($id == "2" OR $id == "31") {
$bgcolor = "FFFFFF";
} else {
$bgcolor = "000000";
}
echo "<table width=\"75%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n";
echo "<td align=\"center\" width=\"100%\" class=\"row3\" valign=\"top\"><object id=\"flash\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"100%\" height=\"500\"><param name=\"movie\" value=\"includes/gallery/animations/$clickurl\"><param name=\"quality\" value=\"high\"><param name=\"menu\" value=\"false\"><param name=\"bgcolor\" value=\"$bgcolor\"><embed id=\"flash\" src=\"includes/gallery/animations/$clickurl\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" menu=\"false\" quality=\"high\" width=\"100%\" height=\"500\"></object></embed></td></table>\n";
echo "<table width=\"75%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n";
echo "<td align=\"center\" width=\"100%\" class=\"row1\" valign=\"top\"><font class=\"forumlink\">"._GALLERY_COMMUNITY." : </font>";
if ($downloadurl == "") {
echo "<font class=\"forumlink\">"._GALLERY_DOWNLOAD." "._GALLERY_STATUS." : </font><font class=\"offline\">"._GALLERY_OFFLINE."</font></td></table><br>\n";
} else {
echo "<font class=\"forumlink\"><a href=\"$downloadurl\" target=\"new\">"._GALLERY_DOWNLOAD."</a> "._GALLERY_STATUS." : </font><font class=\"online\">"._GALLERY_ONLINE."</font></td></table><br>\n";
}
}
cheers