Forum Moderators: coopster

Message Too Old, No Replies

Photo Gallery $ GET If/Then Question

help please!

         

mcjohnson

1:38 am on May 13, 2007 (gmt 0)

10+ Year Member



Hey Friends,

I have a little thumbnail script I've created to pull thumbs from a photo gallery database and display 5 to a page then a "next" and "prev" link when appropriate.

I'd like to use the vey same page to display the enlarged photo.

Here's the code to display the thumbs: (edited for brevity)

<?PHP
// rows to return
$limit=5;
$date = date("Y-m-d");
$title =$row['title'];
$summary =$row['summary'];
$news_id = $row['news_id'];
$thumbnail = $row['thumbnail'];
$title = $row['title'];

$query = "select * from photo_gallery where category_id = 1
order by photo_id desc";

$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
if (empty($s)) {
$s=0;
}
$query .= " limit $s,$limit";
$count = 1 + $s ;
$results=mysql_query($query) or die (mysql_error());
while ($rows=mysql_fetch_array($results)) {
extract ($rows);
echo "&nbsp<a href='http://www.example.com/new/architecturalgallery.php?photo_id=$rows[photo_id]'>";
echo "<img src='http://www.example.com/oneadmin/_files/photogallery/$thumbnail' width=75 height=50 border=1>";
echo "</a>";
echo "&nbsp;";

(etc, etc)

I want to send the thumbnail link to that very page with a GET function and display the larger photo...but the FIRST visit to that page, before a thumbnail is selected, should just show text, i/e/ "choose a photo from the thumbs below"

I am trying to use a "if function exists" to determine whether there has been a thumbnail clicked or not, but I have no clue whether this is proper. It's not working, in any case. Here's the code I am using to try to display the larger photo:

<?php
$photo = $row['photo'];
if (function_exists('.$GET["photo_id"')) {
$query = "SELECT * FROM photo_gallery WHERE photo_id = ".$_GET["photo_id"];
$results=mysql_query($query) or die (mysql_error());
while ($rows=mysql_fetch_array($results)) {
extract ($rows);
echo "<img src='http://www.example.com/oneadmin/_files/photogallery/$photo' width=400 height=300 border=1>";

}} else {
echo "select photo";
}

?>

Can someone spot the errors and provide some insight to achieve the display of the larger photo I am attempting?

Thanks very much!

[edited by: eelixduppy at 1:59 am (utc) on May 13, 2007]
[edit reason] use example.com for exemplification, thanks [/edit]

mcjohnson

11:35 am on May 13, 2007 (gmt 0)

10+ Year Member



please disregard - I figured this out.