dbradbury Posted March 30, 2010 Share Posted March 30, 2010 http://seunlimited.hostei.com/lyrics.php works fine, but i want to change the url, so instead of it going letter=11&artist=45&album and so on.. just want it to be letter=a&artist=ashleytisdale&album and so on... but in my forum the post subjects/forum names have spaces in them, so how would i get round the space...? would i need to used %20? or something... my code for the working page is below: please ask for any info, i will try and provide... oh yeah this is getting information from a mysql phpbb forum.. <div class="lyrics" align="center"> <?php include("connect1.php"); mysql_select_db("a6867437_db") or die("No Database!"); $letter = strtoupper($_GET['letter']); $artist = $_GET['artist']; $album = $_GET['album']; $track = $_GET['track']; $getletter = mysql_query("SELECT forum_name FROM phpbb_forums WHERE parent_id='4' ORDER BY forum_name ASC"); $lettercount = mysql_num_rows($getletter); ?> <table width="100%" border="0"> <tr> <td colspan="3" class="tableletters" align="bottom right"> <div class="extend"></div> <div class="righttext"> Please note that some lyrics may be explicit so view at your own risk<br><br> Also SEUnlimited are looking for lyric writers, Interested? <a href="/contactus.php">Click Here</a><br> <br> </div> <?php if($lettercount==0) { echo "There are no letters as of yet"; } else { $displayletters = mysql_query("SELECT * FROM phpbb_forums WHERE parent_id='4' ORDER BY forum_name ASC"); while($row = mysql_fetch_assoc($displayletters)) { echo ' [<a href=lyrics.php?letter='.$row['forum_id'].'>'.$row['forum_name'].'</a>]'; } } ?> </td> <td valign="top" class="tableartwork" width="50%" height="250"> <?php $getimageurl = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='$album'"); $countimage = mysql_num_rows($getimageurl); if($countimage==0) { print ''; } else while($row7 = mysql_fetch_assoc($getimageurl)) { if ($row7['forum_image'] != '') { print '<center><img src=http://phpbb.seunlimited.hostei.com/'.$row7['forum_image'].' width=250 height=250><br><br></center>'; } else { print '<u>No Album Art Yet!<u><br><br>'; } } ?> </td> </tr> <tr> <td width="18%" valign="top" class="tableartists"> <?php if(isset($_GET['letter'])) { $artistletter = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='$letter'"); $artistletter = mysql_fetch_assoc($artistletter); $artistletter = $artistletter['forum_name']; $getartist = mysql_query("SELECT * FROM phpbb_forums WHERE parent_id='$letter' ORDER BY forum_name ASC"); $artistcount = mysql_num_rows($getartist); echo 'Artist starting with: '.$artistletter.'<br><br>'; if($artistcount==0) { echo ("There are no artists beginning with that letter as of this moment"); } else { $displayartists = $getartist; while($row1 = mysql_fetch_assoc($displayartists)) { echo '<a href=lyrics.php?letter='.$letter.'&artist='.$row1['forum_id'].'>'.$row1['forum_name'].'</a><br>'; } } } else { echo "Please select a letter above!"; } ?> </td> <td width="18%" valign="top" align="left" class="tablealbums"> <div class="scrollable"> <?php if(isset($_GET['artist'])) { $albumartist = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='$artist'"); $albumartist = mysql_fetch_assoc($albumartist); $albumartist = $albumartist['forum_name']; $getalbums = mysql_query("SELECT * FROM phpbb_forums WHERE parent_id='$artist' ORDER BY forum_desc DESC"); $albumcount = mysql_num_rows($getalbums); echo 'Albums by: '.$albumartist.'<br><br>'; if($albumcount==0) { echo "No albums by that artist!"; } else { $displayalbums = $getalbums; while($row2 = mysql_fetch_assoc($displayalbums)) { echo '<a href=lyrics.php?letter='.$letter.'&artist='.$artist.'&album='.$row2['forum_id'].'>'.$row2['forum_name'].'</a><br>'; } } } else { echo "<-- Please select an artist!"; } ?> </div> </td> <td width="25%" valign="top" class="tabletracks"> <div class="scrollable"> <?php if(isset($_GET['album'])) { $albumtracks = mysql_query("SELECT * FROM phpbb_forums WHERE forum_id='$album'"); $albumtracks = mysql_fetch_assoc($albumtracks); $albumtracks = $albumtracks['forum_name']; $gettracks = mysql_query("SELECT * FROM phpbb_topics WHERE forum_id='$album' ORDER BY topic_title ASC"); $trackcount = mysql_num_rows($gettracks); echo 'Tracklisting of: '.$albumtracks.'<br><br>'; if($trackcount==0) { echo 'No tracks on album yet!'; } else { $displaytracks = $gettracks; while ($row3 = mysql_fetch_assoc($displaytracks)) { echo '<a href=lyrics.php?letter='.$letter.'&artist='.$artist.'&album='.$album.'&track='.$row3['topic_id'].'>'.substr_replace($row3['topic_title'], "", 0, 3).'</a><br>'; } } } else { echo "<-- Please select an album"; } ?> </div> </td> <td valign="top" class="tablelyrics"> <div class="scrollable"> <?php if(isset($_GET['track'])) { $getlyrics = mysql_query("SELECT * FROM phpbb_posts WHERE topic_id='$track'"); $lyriccount = mysql_num_rows($getlyrics); if($lyriccount==0) { echo "No lyrics for that song yet!"; } else { $displaylyrics = $getlyrics; while ($row4 = mysql_fetch_assoc($displaylyrics)) { ?><u><?php print substr_replace($row4['post_subject'], "", 0, 3); ?></u><br><br><?php print strtolower(nl2br($row4['post_text'])); ?><br><br><?php $getposterid = $row4['poster_id']; $getpostername = mysql_query("SELECT * FROM phpbb_users WHERE user_id='$getposterid'"); while ($row5 = mysql_fetch_assoc($getpostername)) { print "Posted by: "; print $row5['username']; } } } } ?> </div> </td> </tr> </table> </div> Quote Link to comment https://forums.phpfreaks.com/topic/197042-i-have-this-page-working-perfectly-but-i-want-to-change-it/ Share on other sites More sharing options...
DavidAM Posted March 30, 2010 Share Posted March 30, 2010 Have a look at urlencode() (http://us3.php.net/manual/en/function.urlencode.php) and then urldecode() Quote Link to comment https://forums.phpfreaks.com/topic/197042-i-have-this-page-working-perfectly-but-i-want-to-change-it/#findComment-1034420 Share on other sites More sharing options...
dbradbury Posted March 31, 2010 Author Share Posted March 31, 2010 i havent actually, didnt know it existed lol, thanks, will have a look at that now Quote Link to comment https://forums.phpfreaks.com/topic/197042-i-have-this-page-working-perfectly-but-i-want-to-change-it/#findComment-1034676 Share on other sites More sharing options...
dbradbury Posted March 31, 2010 Author Share Posted March 31, 2010 okay, thanks for that! ive started using it.. rather complicated for me lol but ive got this so far: http://seunlimited.hostei.com/lyrics(new).php it works until i get to the album part.. as it just shows the albums for the last artist, even if im clicked on the first artist. my code for the artist and album part are below.. is there something obviously wrong with it? <td width="18%" valign="top" class="tableartists"> <?php if(isset($_GET['l'])) { $letterid = mysql_query("SELECT * FROM phpbb_forums WHERE forum_name='$l'"); $letterid = mysql_fetch_assoc($letterid); $letterid = $letterid['forum_id']; $getartists = mysql_query("SELECT * FROM phpbb_forums WHERE parent_id='$letterid' ORDER BY forum_name ASC"); $artistcount = mysql_num_rows($getartists); echo 'Artists starting with: '.$l.'<br><br>'; if(artistcount!=0) { echo ("There are no artists beginning with that letter as of this moment"); } else { while($row1 = mysql_fetch_assoc($getartists)) { $artistnum = $row1['forum_id']; $artist = $row1['forum_name']; $aurl = 'lyrics(new).php?l='.$l.'&a='.urlencode($row1['forum_name']); $newartist = str_replace(" ","",$row1['forum_name']); echo '<a href='.$aurl.'>'.$row1['forum_name'].'</a><br>'; } } } else { echo "Please select a letter above!"; } ?> </td> <td width="18%" valign="top" align="left" class="tablealbums"> <div class="scrollable"> <?php if(isset($_GET['a'])) { $adecode = urldecode($a); $artistid = mysql_query("SELECT * FROM phpbb_forums WHERE parent_id='$artistnum'"); $artistid = mysql_fetch_assoc($artistid); $artistid = $artistid['forum_id']; $getalbums = mysql_query("SELECT * FROM phpbb_forums WHERE parent_id='$artistnum' ORDER BY forum_desc DESC"); $albumcount = mysql_num_rows($getalbums); echo 'Albums by: '.$adecode.'<br><br>'; if(albumcount!=0) { echo 'No albums by that artist!'; } else while($row2 = mysql_fetch_assoc($getalbums)) { $albumnum = $row2['forum_id']; $album = $row2['forum_name']; $newalbum = str_replace(" ", "", $row2['forum_name']); $alurl = 'lyrics(new).php?l='.$l.'&a='.urlencode($a).'&al='.urlencode($row2['forum_name']); echo '<a href='.$alurl.'>'.$row2['forum_name'].'</a><br>'; } } else { echo "<-- Please select an artist!"; } ?> </div> </td> Quote Link to comment https://forums.phpfreaks.com/topic/197042-i-have-this-page-working-perfectly-but-i-want-to-change-it/#findComment-1034716 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.