Hello everyone, I'm wondering whether someone can give a suggestion on creating a PHP page that generates different webpages with MySQL. For example, I have a couple of MySQL tables that contain certain information, and I want to query it in order to display content for each page according to the entry's ID. Then, I could run it through a loop and write generic content for each entry. Here is what I have come up with so far: <?php $servername = "localhost"; $serveruser = "user"; $serverpassword = "password"; $connect = mysql_connect($servername, $serveruser, $serverpassword); $db = mysql_select_db("database", $connect); ?> <!DOCTYPE HTML <html lang="en-US"> <head> <?php $query = "SELECT * FROM songs"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { if($row['ID'] == $_GET['id']) { echo "<title>" . $row['title'] . " - Music</title>"; } else { echo " <title>Music - RealRandomRadio</title> "; } } ?> <link rel="stylesheet" type="text/css" href="css.css" /> <link rel="alternate" href="rss/index.php" title="RSS" type="application/rss+xml" /> </head> <body> <p> Page content goes here.</p> <?php $query = "SELECT * FROM songs"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { if($_GET['id'] == $row['ID']) { echo " Your currently listening to " . $row['title'] . "."; } } $query = "SELECT * FROM songs"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $ID = $row['ID']; $title = $row['title']; $artist = $row['artist']; $URL = $row['URL']; $views = $row['views']; echo " <h2>" . $title . "</h2> <p> " . $ID . "<br><br> " . $artist . "<br> <a href='" . $URL . "'>Listen Now</a></p>"; } ?> </body> </html> I know that I made possibly two unnecessary loops, but I can't wrap my head around another solution that would work. If someone could please assist me with figuring out something that could make this simpler or improve it, I would greatly appreciate it! -- Thanks for reading. Have a good day. If you ever get the chance, go to http://www.realrandomradio.com and check us out. ** To leave the list, click on the immediately-following link:- ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe] ** If this link doesn't work then send a message to: ** program-l-request@xxxxxxxxxxxxx ** and in the Subject line type ** unsubscribe ** For other list commands such as vacation mode, click on the ** immediately-following link:- ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq] ** or send a message, to ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq