Jump to content

Archived

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

speedy33417

db question

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]

Share this post


Link to post
Share on other sites
[quote author=Barand link=topic=110069.msg444235#msg444235 date=1159626156]
Change

if ($album="main")

to

if ($album=="main")
[/quote]

I love programming..

Share this post


Link to post
Share on other sites

×

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.