Hi,
Thanks for the input. Actually, what I am doing is having the thumbnails show up on the results page. What I am trying to do, is set it up so a visitor can click on the thumbnail and have it link to another page with a larger image. I use different file names for each size in my database.
So, using the script below, what do I need to add to have it hyperlink to the larger image?
$per_page = 10;
// Selects all of the data from database
$sql_text = ("SELECT * from photo ORDER BY id DESC");
// Sets page number, if no page is specified, it will create page 1
if(!$page) {
$page = 1;
}
$prev_page = $page - 1;
$next_page = $page + 1;
$query = @($sql_text);
// Sets up specified page
$page_start = ($per_page * $page) - $per_page;
$num_rows = @mysql_num_rows($query);
if($num_rows <= $per_page) {
$num_pages = 1;
}
else if (($num_rows % $per_page) == 0) {
$num_pages = ($num_rows / $per_page);
}
else {
$num_pages = ($num_rows / $per_page) + 1;
}
$num_pages = (int) $num_pages;
if (($page > $num_pages) || ($page < 0)) {
error("You have specified an invalid page number");
}
$sql_text = $sql_text . " LIMIT $page_start, $per_page";
$query = mysql_query($sql_text);
?>
<!-- This starts the web page with HTML and PHP embedded. -->
<!-- It also counts how many photos are present in the photo gallery. -->
<title>US Legacies Old Photographs</title>
<body bgcolor="#ffffff">
<blockquote> There are currently<font color="red">
<?php echo "$num_rows"; ?> </font> photos in this photograph collection<p>
<!-- It loops through the rows and obtains the data that we created in the table. -->
<?php
while ($result = mysql_fetch_array($query)) {
$title= $result["title"];
$photo= $result["photo_thumb"];
// Using HTML "img" tags for the photos, it selects the photo by it's "id" number
echo "$title<br>";
echo ("<img src=\"$photo\" border=0><P><HR width=400 align=left>");
}
// This displays the "Previous" link
if ($prev_page) {
echo "<a href=\"$PHP_SELF?page=$prev_page\">< Prev</a>";
}
// This loops the Pages and displays individual links corresponding
// to the photos.
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo " <a href=$PHP_SELF?page=$i>$i</a>";
} else {
echo " $i ";
}
}
// This displays the "Next" link.
if ($page != $num_pages) {
echo " |<a href=\"$PHP_SELF?page=$next_page\"> Next ></a>" ;
}