okay, here's what I'm trying to do...
I'm redesigning my band's website, and I wanna plan for the future a little so I don't have to redesign the code anymore..
so I've got to plan for future albums and I want to do it in two databases, one listing the albums and their details.. and the other listing the tracks from all the albums, their track numbers, their lyrics and song notes.. I'm trying to write the a PHP script that sorts all the information and displays it, and it's not working how I had it planned,
the database structures
content_albumlist
-id
-albid
-albumname
-image
-guitar
-bass
-recording
-notes
-credits
-thanks
content_lyrics
-id
-albid
-albumname
-tracknum
-title
-time
-credits
-lyrics
-notes
the code for the list works fine,
// query the database and pull a specific record for the page
$sql = "SELECT * FROM content_albumlist";
$result = mysql_query($sql,$db);
while($albumlist = mysql_fetch_array($result))
{
echo "<tr>\n".
"<td align=\"center\">\n".
"<a href=\"albums.php?album=" .
$albumlist["albid"] .
"\"><img border=\"0\" src=\"" . $albumlist["image"] .
"\"><br>[ " . $albumlist["albumname"] . " ]</a><br><br>".
"</td>\n".
"</tr>\n\n";
}
quick and dirty... it's the code for the listing of the tracks that confuses me, I figured I could just loop through the track list and the album list individually and just use the albid field to have it all sorted for me.. which it did, UNTIL I tried to add the Album notes inbetween the two track loops..
first track loop, gathers the track names and displays them, I removed the HTML for the java content switcher so it's easier to read.
// query the database
$sql = "SELECT * FROM content_lyrics WHERE albid='$album'";
$result = mysql_query($sql,$db);
while($song = mysql_fetch_array($result))
{
echo $song["tracknum"] . '-' . $song["title"];
}
Then the album loop
$sql = "SELECT * FROM content_albumlist WHERE albid='$album'";
$albumnotes = mysql_query($sql,$db);
$album = mysql_fetch_array($albumnotes);
$guitar = nl2br (strip_tags ($album["guitar"], $tagstrip));
$bass = nl2br (strip_tags ($album["bass"], $tagstrip));
$recording = nl2br (strip_tags ($album["recording"], $tagstrip));
$notes = nl2br (strip_tags ($album["notes"], $tagstrip));
$credits = nl2br (strip_tags ($album["credits"], $tagstrip));
$thanks = nl2br (strip_tags ($albim["thanks"], $tagstrip));
then the second track loop for displaying all the 'hidden' content (javascript content switcher)
// query the database and pull a specific record for the page
$sql = "SELECT * FROM content_lyrics WHERE albid='$album'";
$result = mysql_query($sql,$db);
while($song = mysql_fetch_array($result))
{
$credits = nl2br (strip_tags ($song["credits"], $tagstrip));
$lyrics = nl2br (strip_tags ($song["lyrics"], $tagstrip));
$notes = nl2br (strip_tags ($song["notes"], $tagstrip));
echo $song["tracknum"] . $credits . $lyrics . $notes
}
when I look at the source in HTML, it doesn't do diddly beans with the third loop.. just ignores it.. further, if I put the album loop in front of the FIRST track loop, it ignores both of the track loops.
what dingbat stupid thing am I doing wrong? I just want to loop content from two tables in a database!!