if statement
Posted: Sat Sep 30, 2006 8:07 am
I'm working on a photo album, where I need to get a path out of my database. $album indicates which album we're seeing and determines a path_id. The value of $album can be "main" if we're still on the main page or "some album name" if we already made an album selection.
If $album="main", then I don't need to need to do anything and $path=""
If $album is other than "main" then I need to get the correct path_id, then get the correct path. For some reason I'm not getting the else part of my if statement working.
Here's my code:
If $album="main", then I don't need to need to do anything and $path=""
If $album is other than "main" then I need to get the correct path_id, then get the correct path. For some reason I'm not getting the else part of my if statement working.
Here's my code:
Code: Select all
if ($album="main") {
$path="";
} else {
echo "I'm here";
$sql2 = "SELECT album_pathid FROM albums WHERE album_thumbpicfilename = '$album' ";
$pathresult = mysql_query($sql2);
while ($row = mysql_fetch_assoc($pathresult))
{
$pathid['album_pathid'][] = $row['album_pathid'];
}
$pathid = $pathid['album_pathid'][0];
$sql3 = "SELECT path_text FROM paths WHERE path_id = '$pathid' ";
$pathresult = mysql_query($sql3);
while ($row = mysql_fetch_assoc($pathresult))
{
$path['path_id'][] = $row['path_id'];
}
$path = $path['path_id'][0];
}