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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.