macromedia.dreamweaver.appdev
[Top] [All Lists]

Re: PHP IF/ELSE

Subject: Re: PHP IF/ELSE
From: "Murray *ACE*"
Date: Fri, 5 Sep 2008 08:16:47 -0400
Newsgroups: macromedia.dreamweaver.appdev


Let's see the whole thing, please.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"Murray *ACE*" <forums@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:g9r5qb$rpn$1@xxxxxxxxxxxxxxxxxxxxxxxx
$photo = isset($_GET['photo'])?$_GET['photo']:'photo1';
$photo=($row_rs_properties[$photo]);

Make sure that this comes AFTER the recordset.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"davecheet" <webforumsuser@xxxxxxxxxxxxxx> wrote in message news:g9r2sb$os4$1@xxxxxxxxxxxxxxxxxxxxxxxx
I have six thumbnails on a page and a large image. On clicking the thumbnail the thumbnail reloads the page with a URL variable 'photo' which then becomes
the enlarged  image source. All of that works perfectly at the moment.

However, the first time the page is loaded the URL variable 'photo' is not present so I'm trying to use IF/ELSE to automatically make it show 'photo 1' if
URL variable 'photo' is not present.

Unfortunately I just can't make it work. The image source returns blank when no URL variable is present instead of defaulting to $row_rs_properties['photo1']

Can anyone suggest why this code doesn't work?

Dave

<?php
//set photo variable if URL variable is present
if(isset($_GET['photo']))
{
$photo=($_GET['photo']);
}
// set photo variable to photo 1 if URL variable is not present
else{
$photo=($row_rs_properties['photo1']);
}
?>

//main image source uses $photo
<img src="images/propertyimages/<?php echo $photo; ?>"




<Prev in Thread] Current Thread [Next in Thread>