Im fairly new to php so please don't shoot me if i get anything wrong. Im Working with Dreamweaver,PHP and MySQL database. I have some pages on my website:

catalogue_main.php
alpha_artist.php
lyrics_artists.php

This is to lead up to a lyrics page. So on the catalogue_main.php page theres a alphabet and whatever you click on it takes you to the artists whose name begins with that letter, which is displayed on the alpha_artist page. This works successfully. I know want when you click on that artist, it shows you their specific albums which would be displayed in the lyrics_artists.php page. Here are the tables i have:

albums
-album_id
-artist
-album_name

-tracklisting
-genre
-release_date
-price
-album_image
-album_description

artists
-artist_ID
-artist
-artist_letter

-artist_info
-image

media
-media_id
-song_url
-video_url
-artist
-album
-song_title
-lyrics

The ones in bold are the field names id like to be included in the php script,but if you recommend any others thats fine 😉. The edition of mhpmyadmin i have doesnt enable linked tables. Here is the code i have for both of the pages...i just cant seem to get it to work. It just displays one album for all the records.

    alpha_artist.php

    <?php require_once('Connections/conn1.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
    
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
    case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_conn1, $conn1); $query_alpha = "SELECT * FROM artists"; $alpha = mysql_query($query_alpha, $conn1) or die(mysql_error()); $row_alpha = mysql_fetch_assoc($alpha); $totalRows_alpha = mysql_num_rows($alpha); mysql_select_db($database_conn1, $conn1); /////////////////////////////// $at=$_GET['AlphaType']; $result = mysql_query("SELECT * FROM artists WHERE artist_letter='$at'"); $an=$_GET['artist']; $a_Image = array (); $a_Artist = array(); while($row = mysql_fetch_array($result)) { $a_Image[$row['artist_ID']]= $row['image']; $a_Artist[$row['artist_ID']]= $row['artist']; } ////////////////////////////// $query_musiccatalogue = "SELECT * FROM artists "; $musiccatalogue = mysql_query($query_musiccatalogue, $conn1) or die(mysql_error()); $row_musiccatalogue = mysql_fetch_assoc($musiccatalogue); $totalRows_musiccatalogue = mysql_num_rows($musiccatalogue); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Design by http://www.iWebsiteTemplate.com Released for free under a Creative Commons Attribution 3.0 License --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>iWebsiteTemplate.com</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style.css" rel="stylesheet" type="text/css" /> <!-- CuFon: Enables smooth pretty custom font rendering. 100% SEO friendly. To disable, remove this section --> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/arial.js"></script> <script type="text/javascript" src="js/cuf_run.js"></script> <!-- CuFon ends --> <style type="text/css"> <!-- body { background-color: #000; } --> </style></head> <body> <div class="main"> <div class="header"> <div class="header_resize"> <div class="logo"> <h1><a href="index.html"></a></h1> </div> <div class="menu_nav"> <ul> <li class="active"><a href="index.html">Home</a></li> <li><a href="support.html">Catalogue</a></li> <li><a href="contact.html">Media</a></li> <li><a href="blog.html">Blog</a></li> <li><a href="contact.html">Downloads</a></li> <li><a href="contact.html">Search</a></li> <li><a href="about.html">About Us</a></li> <li><a href="contact.html">Contact Us</a></li> </ul> </div> <div class="clr"></div> </div> </div> <div class="hbg">&nbsp;</div> <div class="content"> <div class="content_resize"> <div class="mainbar"> <div class="article"> <p>Browse by Artist</p> <table width="200" border="1" align="center"> <tr> <td><a href="alpha_artist.php?AlphaType=A"><img src="images/letters/a.jpg" alt="" width="32" height="32" /></a></td> <td><a href="alpha_artist.php?AlphaType=b"><img src="images/letters/b.jpg" alt="" width="32" height="32" /></a></td> <td><a href="alpha_artist.php?AlphaType=C"><img src="images/letters/c.jpg" alt="" width="32" height="32" /></a></td> <td><a href="alpha_artist.php?AlphaType=D"><img src="images/letters/d.jpg" alt="" width="32" height="32" /></a></td> <td><a href="alpha_artist.php?AlphaType=E"><img src="images/letters/e.jpg" alt="" width="32" height="32" /></a></td> <td><a href="alpha_artist.php?AlphaType=Z"><img src="images/letters/z.jpg" alt="" width="32" height="32" /></a></td> </tr> </table> <h2>&nbsp;</h2> <table width="348" border="1"> <tr> <td width="105">Artist</td> <td width="274">&nbsp;</td> </tr> <?php do { ?> <tr> <?php foreach($a_Image as $key=>$value) { ?> <td><label><a href="lyrics_artists.php?album=album_name"><img src="<?php echo $value; ?>" alt="" width="95" height="100" /></a></label></td> <td><?php echo $a_Artist[$key]; ?></td> </tr> <?php } while ($row_alpha = mysql_fetch_assoc($alpha)); ?> <?php } while ($row_alpha = mysql_fetch_assoc($alpha)); ?> </table> <p>&nbsp; </p> </div> <div class="article"> <h2>&nbsp;</h2> </div> </div> <div class="sidebar"> <div class="gadget"> <h2 class="star"><span>Sidebar</span> Menu</h2><div class="clr"></div> <ul class="sb_menu"> <li><a href="#">Home</a></li> <li><a href="#">My Account</a></li> <li><a href="#">Music Lyrics</a></li> <li><a href="#">Gallery</a></li> <li><a href="#"></a>Artists Details</li> <li><a href="#">Latest News</a><a href="http://www.dreamtemplate.com" title="Website Templates"></a></li> <li>Single Chart</li> <li>Album Chart</li> </ul> </div> <div class="gadget"> <h2 class="star"><span>Sponsors</span></h2><div class="clr"></div> <ul class="ex_menu"> <li><a href="http://www.dreamtemplate.com" title="Website Templates">HMV</a><br />Over 6,000+ Premium Web Templates</li> <li><a href="http://www.templatesold.com/">WHSmith Entertainment</a><br />Premium WordPress &amp; Joomla Themes</li> <li><a href="http://www.imhosted.com" title="Affordable Hosting">Jango</a><br />Affordable Web Hosting Provider</li> <li></li> <li></li> </ul> </div> </div> <div class="clr"></div> </div> </div> <div class="fbg"> <div class="fbg_resize"> <div class="banner_advert"> <p><img src="images/banner_advert.png" alt="" width="610" height="147" /></p> </div> <div class="clr"></div> </div> </div> <div class="footer"> <div class="footer_resize"> <p class="lf">© Copyright <a href="#">MusicGalore</a>. Layout by <a href="http://www.iwebsitetemplate.com/">Aysha Dar</a></p> <ul class="fmenu"> <li class="active"><a href="file:///E|/FYP/Templates/yellowbubbles/html/index.html">Home</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/support.html">Support</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/blog.html">Blog</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/about.html">About Us</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/contact.html">Contacts</a></li> </ul> <div class="clr"></div> </div> </div> </div> </body> </html> <?php mysql_free_result($alpha); ?> <?php mysql_free_result($musiccatalogue); ?>

      lyrics_artists.php

      <?php require_once('Connections/conn1.php'); ?>
      <?php
      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
      {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      
        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      
        switch ($theType) {
          case "text":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;    
      case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_conn1, $conn1); $query_Lyrics1 = "SELECT * FROM media inner join albums WHERE media.album = albums.album_name"; $Lyrics1 = mysql_query($query_Lyrics1, $conn1) or die(mysql_error()); $row_Lyrics1 = mysql_fetch_assoc($Lyrics1); $totalRows_Lyrics1 = mysql_num_rows($Lyrics1); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break;
      case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Design by http://www.iWebsiteTemplate.com Released for free under a Creative Commons Attribution 3.0 License --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Home</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="style.css" rel="stylesheet" type="text/css" /> <!-- CuFon: Enables smooth pretty custom font rendering. 100&#37; SEO friendly. To disable, remove this section --> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/arial.js"></script> <script type="text/javascript" src="js/cuf_run.js"></script> <!-- CuFon ends --> <style type="text/css"> <!-- body { background-color: #000; } .style51 { font-size: 24px; color: #A70000; } --> </style></head> <body> <div class="main"> <div class="header"> <div class="header_resize"> <div class="logo"> <h1><a href="index.html"></a></h1> </div> <div class="menu_nav"> <ul> <li class="active"><a href="index.php">Home</a></li> <li><a href="catalogue.php">Catalogue</a></li> <li><a href="media.php">Media</a></li> <li><a href="blog.php">Blog</a></li> <li><a href="downloads.php">Downloads</a></li> <li><a href="search.php">Search</a></li> <li><a href="about.php">About Us</a></li> <li><a href="contact.php">Contact Us</a></li> </ul> </div> <div class="clr"></div> </div> </div> <div class="hbg">&nbsp;</div> <div class="content"> <div class="content_resize"> <div class="mainbar"> <div class="article"> <h2>Template License</h2> <div class="clr"></div> <p>&nbsp;</p> <table width="100%" border="0" cellspacing="2" cellpadding="0"> <tr> <td>&nbsp;</td> <td>Albums</td> </tr> <tr> <td>&nbsp;</td> <td><?php echo $row_Lyrics1['album']; ?></td> </tr> </table> </div> <div class="article"> <h2>&nbsp;</h2> <div class="clr"></div> <p>&nbsp;</p> </div> </div> <div class="sidebar"> <div class="gadget"> <h2 class="star"><span>Sidebar</span> Menu</h2><div class="clr"></div> <ul class="sb_menu"> <li><a href="#">Home</a></li> <li><a href="#">My Account</a></li> <li><a href="#">Music Lyrics</a></li> <li><a href="#">Gallery</a></li> <li><a href="#"></a>Artists Details</li> <li><a href="#">Latest News</a><a href="http://www.dreamtemplate.com" title="Website Templates"></a></li> <li>Single Chart</li> <li>Album Chart</li> </ul> </div> <div class="gadget"> <h2 class="star"><span>Adverts/Polls/Charts</span></h2><div class="clr"></div> <ul class="ex_menu"> <li></li> <li></li> <li></li> <li></li> <li></li> <li> </li> <li></li> </ul> </div> <div class="gadget"> <h2 class="star"><span>Sponsors</span></h2><div class="clr"></div> <ul class="ex_menu"> <li><a href="http://www.dreamtemplate.com" title="Website Templates">HMV</a><br /> Over 6,000+ Premium Web Templates</li> <li><a href="http://www.templatesold.com/">WHSmith Entertainment</a><br /> Premium WordPress &amp; Joomla Themes</li> <li><a href="http://www.imhosted.com" title="Affordable Hosting">Jango</a><br /> Affordable Web Hosting Provider</li> </ul> </div> </div> <div class="clr"></div> </div> </div> <div class="fbg"> <div class="fbg_resize"> <div class="banner_advert"> <p><img src="images/banner_advert.png" width="610" height="147" /></p> </div> <p>&nbsp;</p> <div class="clr"></div> </div> </div> <div class="footer"> <div class="footer_resize"> <p class="lf">&#169; Copyright <a href="#">MusicGalore</a>. Layout by <a href="http://www.iwebsitetemplate.com/">Aysha Dar</a></p> <ul class="fmenu"> <li class="active"><a href="file:///E|/FYP/Templates/yellowbubbles/html/index.html">Home</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/support.html">Support</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/blog.html">Blog</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/about.html">About Us</a></li> <li><a href="file:///E|/FYP/Templates/yellowbubbles/html/contact.html">Contacts</a></li> </ul> <div class="clr"></div> </div> </div> </div> </body> </html> <?php mysql_free_result($Lyrics1); mysql_free_result($Recordset1); ?>

      (sorry it wouldnt let me post everything in one post) Help would be much greatly apprecciated! Thanks 😃

        Write a Reply...