Jump to content

how do i manipulate this to make it work?


dbradbury

Recommended Posts

at the moment i have this site: http://seunlimited.hostei.com/lyrics.php

and when you go on to certain letters, then artist then albums and so on the url will change to something like: lyrics.php?letter=11&artist=63&album=.. and so on.. but i wanna change the url so its shows the letter and artist and such so the url would turn out like this lyrics.php?l=A&a=Ashley+Tisdale&al=Guilty+Pleasure.... ive used urlencode and decode but i dont think im using it right :s

 

could someone help me please? :)

 

my code for the working page:

<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>

If there are spaces in the field, you'll need to use urlencode(). If you suspect you're not using urlencode() properly, show us an example of how you were using it in the script, and maybe someone can help you with the syntax.

        <?php
	if(isset($_GET['l']))
	{
		$letter = mysql_query("SELECT * FROM phpbb_forums WHERE forum_name='$l'");
		$letter = mysql_fetch_assoc($letter);
		$letter = $letter['forum_id'];
		$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: '.$l.' '.$letter.'<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=lyrics1.php?l='.$l.'&a='.urlencode($row1['forum_name']).'>'.$row1['forum_name'].'</a><br>';
			}
		}
	}
	else
	{
		echo "Please select a letter above!";
	}
	?>

 

im not sure if that works to retrieve the next info

thought id let you know, i have gotten it to work before, but when choosing the album part, it would only show the one from the last artist even if you have selected a different one.

 

like say for instance, ive clicked alanis morrisette.. then it would show albums by avril lavigne, its only showing the last one or something...

Archived

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

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