speedy33417 Posted September 30, 2006 Share Posted September 30, 2006 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:[code] 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]; }[/code] Link to comment https://forums.phpfreaks.com/topic/22587-db-question/ Share on other sites More sharing options...
Barand Posted September 30, 2006 Share Posted September 30, 2006 Changeif ($album="main") toif ($album=="main") Link to comment https://forums.phpfreaks.com/topic/22587-db-question/#findComment-101379 Share on other sites More sharing options...
acdx Posted September 30, 2006 Share Posted September 30, 2006 [quote author=Barand link=topic=110069.msg444235#msg444235 date=1159626156]Changeif ($album="main") toif ($album=="main") [/quote]I love programming.. Link to comment https://forums.phpfreaks.com/topic/22587-db-question/#findComment-101388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.