Jump to content

db question


speedy33417

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.