The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
really need some help
i been trying to learn to code and took on a project but nevermind all that i am stumped so i will show you the code. i need to be able to grab song listings from a database table and show them in a neat table.
if i go here info.php?artist=Artistname with the below code it will show all the albums in the database and info to go with it but what ever i have tried i cant get it to show a table with all the songs in the database to go with the album... Code:
<? connectdbase(); $artist=str_replace("|","&",$artist); $artist=str_replace("***","\'",$artist); $sql="SELECT ID,title,artist,albumyear,genre,album, picture from songlist WHERE artist='$artist' GROUP BY album ORDER BY album"; $result=mysql_query($sql); while($data=mysql_fetch_object($result)) if($data->album!=''){ echo "<table class=alt2 border=0 width=100%><tr><td>"; echo "<table border=0 width=100% height=96><tr><td class=thead height=21><p align=left><font color=#c0c0c0>".$data->album." | Fan Rating: 9.4 | Rate this album</font></a></p></td></tr>"; echo "<tr><td><table border=0 width=100%><tr><td><center><img src=pictures/".$data->picture."' border='1'width='130'height='130'></center></td><td width=30%><b>Artist</b>: ".$data->artist."</a><br><b>Album</b>: ".$data->album."<br><b>Release Date</b>: ".$data->albumyear."<br><b>Genre</b>: ".$data->genre."</td>"; echo "<td width=50%><p align=left>"; <------ right here i want to display table----> with the song listings for this current album echo "</td>"; echo "</tr>"; echo "</td></tr></table>"; echo "</td></tr></table>"; $artist=mysql_escape_string($data->artist); $album=mysql_escape_string($data->album); $sql2="SELECT title from songlist WHERE artist='$artist' AND album='$album'"; $result2=mysql_query($sql2); $tracks=0; while($data2=mysql_fetch_object($result2)) { $tracks++; } if($tracks>0){ echo "$tracks</td></tr>"; } else { echo "none"; } echo "</td></tr>"; $count++; } ?> in the above code is what i have so far. and you can see a arrow and where i would like to throw in a table that grabs the songs for the album associated.. if i type ".$data->title." it will show the first track but no others. thats where i get stuck the code below is standalone which will grab the songs for that artists if i call the page info.php?artist=Artistname&album=albumname Code:
<table> <tr align=center bgcolor="<? echo $tbl_hdr; ?>"> <td> <font size=1 color="<? echo $text; ?>" face=tahoma> Num </td> <td> <font face=tahoma size=1 color="<? echo $text; ?>"> TRACK NAME </td> <tr> <td> <font face=tahoma size=1 color="<? echo $highlight; ?>"> <? $count=0; $artist=$data->artist; connectdbase(); $query2 = "select ID,title,trackno from songlist WHERE album='$album' and artist='$artist' ORDER BY trackno"; $result2 = mysql_query($query2); while($data2=mysql_fetch_object($result2)) { $count++; if(($count % 2)==0){ $bgcolor=$dark; } else { $bgcolor=$light; } echo "<tr bgcolor=$bgcolor><td><font size=2 face=tahoma color='$highlight'>"; if($data2->trackno!='0'){ echo $data2->trackno; } else { echo $count; } echo "</td/><td><font face=tahoma size=2 color='$text'>"; echo $data2->title; echo "</td></tr>"; } ?> </td> </tr> </table> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|