Jump to content

One page System...linking Artists to specific albums


Recommended Posts

Okay so im not that new with PHP but im still learning. So im creating a php website with dreamweaver CS3 and phpmyadmin, which is based on a Music Library. I have a page where you can browse by the artists name. When you click on that it shows you all the artists with that name. But its the next part im having difficulty with. Keeping this as a one page system, i want the artists albums to be displayed when you click on a particular artist. I tried some methods but it doesnt seem to work  :-[

 

[Refer to the images from below]

Image1 shows the alphabetical list..clicking on any of these takes you to Image 2 which displays all the artists. By clicking on one of these artists i want it to take me to a seperate page which shows all their albums. And by clicking on the albums it shows song names from those particular albums. These song names will then be linked to actual lyrics of the song.

 

There are three tables i have on phpmyadmin which i want the data to be from. These are

 

albums

-album_id

-artist

-album_name

-tracklisting

-genre

-release_date

-price

-album_image

-album_description

 

artists

-artist_ID

-artist

-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. The edition of mhpmyadmin i have doesnt enable linked tables. any help would be greatly appreciatted. Thanks.  :)

 

 

 

 

[attachment deleted by admin]

Okay so i have 5 pages:

 

    1 catalogue.php

    2 artists.php

    3 albums.php

    4 songs.php

    5 lyrics.php

 

and i want them linked as shown below (numbers referring to page from above):

 

1.Main Catalogue A-Z artists ---> 2.List of Artists according to Specific Letter ---> 3.Lists of Specific Albums according to chosen Artist ---> 4.List of Songs from Album ---> 5.Lyrics of Song

 

The pages in bold are the ones i got working. Now i want when you click on an artist from the list on the second page, it takes you to display their albums. I want all the results to be displayed on ONE page just like they are for the second page.

 

So for example:

From the catalogue.php page, a bunch of artists whos first letter of their name start with A would be displayed as a result on the artists.php page,it would be the same case with the letter B. But when they click on an artist, it goes to the albums.php page and if they choose another artist it still goes to the albums.php page. This is what im trying to get help with. How can i make this work referring to my tables in the first post?

I WANT a car that can fly - Possible? yes; Realistic? perhaps; Serve a TRUE purpose? questionable; Easy? NO

 

There are ABSOLUTE geniuses in site creation and design who make multiple page sites.  Single page sites are considerably more difficult to  maintain, change and debug.

 

That said, IF you still want a 'single page', the next question is: May the page refresh or must it only change specific content in specific areas of the screen?

 

If refresh is acceptable, session variables and a series of if's and switches should accomplish your goal.

 

if refresh is not acceptable - ajax is definitely something to investigate - simple sample here

source: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

 

 

I WANT a car that can fly - Possible? yes; Realistic? perhaps; Serve a TRUE purpose? questionable; Easy? NO

 

If you have the money, here's the car:

 

http://www.youtube.com/watch?v=ElS9BKSsezw

 

@OP All these items are too small to put on a specific page (except the lyrics that is) I would go for an approach where you have multiple selects next to each other and that users can click through the several selects to find the lyrics they need:

 

<style>.lw200 { float: left; width: 200px; }</style>
<form action="" method="post">
<div class="lw200">
Catalogue:
<select size="20" onchange="fillArtistSelect(this.options[this.selectedIndex].value)">
  <option>A</option>
  <option>..</option>
  <option>Z</option>
</select>
</div>
<div class="lw200">
Artists:
<select size="20" onchange="fillAlbumSelect(this.options[this.selectedIndex].value)"></select>
</div>
<div class="lw200">
Albums:
<select size="20" onchange="fillSongSelect(this.options[this.selectedIndex].value)"></select>
</div>
<div class="lw200">
Songs:
<select size="20" onchange="enableSubmit()"></select>
</div>
<input type="submit" name="Find Lyrics" disabled="disabled">
</form>

 

It's also recommended you refer them to a lyrics page where the above form is also present (and filled in according to their last search so that they can find multiple lyrics without much hussle).

I WANT a car that can fly - Possible? yes; Realistic? perhaps; Serve a TRUE purpose? questionable; Easy? NO

 

If you have the money, here's the car:

 

http://www.youtube.com/watch?v=ElS9BKSsezw

 

@OP All these items are too small to put on a specific page (except the lyrics that is) I would go for an approach where you have multiple selects next to each other and that users can click through the several selects to find the lyrics they need:

 

<style>.lw200 { float: left; width: 200px; }</style>
<form action="" method="post">
<div class="lw200">
Catalogue:
<select size="20" onchange="fillArtistSelect(this.options[this.selectedIndex].value)">
  <option>A</option>
  <option>..</option>
  <option>Z</option>
</select>
</div>
<div class="lw200">
Artists:
<select size="20" onchange="fillAlbumSelect(this.options[this.selectedIndex].value)"></select>
</div>
<div class="lw200">
Albums:
<select size="20" onchange="fillSongSelect(this.options[this.selectedIndex].value)"></select>
</div>
<div class="lw200">
Songs:
<select size="20" onchange="enableSubmit()"></select>
</div>
<input type="submit" name="Find Lyrics" disabled="disabled">
</form>

 

It's also recommended you refer them to a lyrics page where the above form is also present (and filled in according to their last search so that they can find multiple lyrics without much hussle).

 

Thanks for this, so if i were to use this version i guess id have to use the table (the ones in bold will be the fields i'll grab data from) :

media

-media_id

-song_url

-video_url

-artist

-album

-song_title

-lyrics

 

so i guess id have to have another field name such as alphabet_name: which would have the first letter of the artists name?

 

Also im confused about something  :confused:

 

for this "fillAlbumSelect(this.options[this.selectedIndex].value)" would i need to fill anything according to my field name??

 

If you have something which suits my initial method if thats possible id be much comfortable with that. Heres an example of what i'm trying to accomplish. I have a categories_musicdata.php page which displays a list of albums and when they click on an album it takes them to a allmusic_details.php page. This seems to work so it shows the particular details for the album you clicked on. This is how i want the other pages to work. I tried the same method but achieved no results. Here are the codes for these pages.

 

categories_musicdata.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_Allmusic = "SELECT * FROM albums, artists";
$Allmusic = mysql_query($query_Allmusic, $conn1) or die(mysql_error());
$row_Allmusic = mysql_fetch_assoc($Allmusic);
$totalRows_Allmusic = mysql_num_rows($Allmusic);
$query_Allmusic = "SELECT * FROM albums, artists ";
$Allmusic = mysql_query($query_Allmusic, $conn1) or die(mysql_error());
$row_Allmusic = mysql_fetch_assoc($Allmusic);
$totalRows_Allmusic = mysql_num_rows($Allmusic);
$query_Allmusic = "SELECT * FROM albums, artists ";
$Allmusic = mysql_query($query_Allmusic, $conn1) or die(mysql_error());
$row_Allmusic = mysql_fetch_assoc($Allmusic);
$totalRows_Allmusic = mysql_num_rows($Allmusic);
$query_Allmusic = "SELECT * FROM albums, artists ";
$Allmusic = mysql_query($query_Allmusic, $conn1) or die(mysql_error());
$row_Allmusic = mysql_fetch_assoc($Allmusic);
$totalRows_Allmusic = mysql_num_rows($Allmusic);

mysql_select_db($database_conn1, $conn1);

$query_All_music = "SELECT * FROM albums";
$All_music = mysql_query($query_All_music, $conn1) or die(mysql_error());
$row_All_music = mysql_fetch_assoc($All_music);
$totalRows_All_music = mysql_num_rows($All_music);

mysql_select_db($database_conn1, $conn1);
///////////////////////////////
$mt=$_GET['MusicType'];
$result = mysql_query("SELECT * FROM albums WHERE genre='$mt'");

$mt_Image = array ();
$mt_Artist = array();
$mt_AlbumName = array();
$mt_ReleaseDate = array();
$mt_Price = array();

while($row = mysql_fetch_array($result))
{
   $mt_Image[$row['album_id']]= $row['album_image'];
   $mt_Artist[$row['album_id']]= $row['artist'];
   $mt_AlbumName[$row['album_id']]= $row['album_name'];
   $mt_ReleaseDate[$row['album_id']]= $row['release_date'];
   $mt_Price[$row['album_id']]= $row['price'];
}

//////////////////////////////
$query_musiccatalogue = "SELECT * FROM albums ";
$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>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% 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"> </div>

  <div class="content">
    <div class="content_resize">
      <div class="mainbar">
        <div class="article">
          <p> </p>
          <p> </p>
          <table width="649" border="1">
            <tr>
              <td width="110"> </td>
              <td width="154">Artist</td>
              <td width="172">Album Name</td>
              <td width="108">Release Date</td>
              <td width="71">Price</td>
            </tr>
            <?php do { ?>
              <tr>
              <?php foreach($mt_Image as $key=>$value) { ?>
                <td><label><a href="allmusic_details.php?album_id=<?php echo $key; ?>&album_name=<?php echo $mt; ?>"><img src="<?php echo $value; ?>" alt="" width="100" height="100" /></a></label></td>
                <td><?php echo $mt_Artist[$key]; ?></td>
                <td><?php echo $mt_AlbumName[$key]; ?></td>
                <td><?php echo $mt_ReleaseDate[$key]; ?></td>
                <td><?php echo $mt_Price[$key]; ?></td>
              </tr>
              <?php } while ($row_All_music = mysql_fetch_assoc($All_music)); ?>
              <?php } while ($row_All_music = mysql_fetch_assoc($All_music)); ?>
          </table>
          <p> </p>
          <p class="comic_sans" style="font-family: 'Comic Sans MS'; font-size: 16px; text-align: center;"> </p>
          <p> </p>
        </div>
        <div class="article">
          <p style="font-family: 'Comic Sans MS', cursive"> </p>
          <h2> </h2>
          <div class="clr"></div>
          <p> </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>

              Over 6,000+ Premium Web Templates</li>
            <li><a href="http://www.templatesold.com/">WHSmith Entertainment</a>

              Premium WordPress & Joomla Themes</li>
            <li><a href="http://www.imhosted.com" title="Affordable Hosting">Jango</a>

              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> </p>
      <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="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 class="clr"></div>
    </div>
  </div>
</div>
</body>
</html>
<?php
mysql_free_result($Allmusic);

mysql_free_result($All_music);
?>
<?php
mysql_free_result($musiccatalogue);
?>

 

allmusic_details.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;
}
}

$colname_Allmusic = "8";
if (isset($_GET['album_id'])) {
  $colname_Allmusic = $_GET['album_id'];
}
mysql_select_db($database_conn1, $conn1);
$query_Allmusic = sprintf("SELECT * FROM albums, artists WHERE album_id = %s", GetSQLValueString($colname_Allmusic, "int"));
$Allmusic = mysql_query($query_Allmusic, $conn1) or die(mysql_error());
$row_Allmusic = mysql_fetch_assoc($Allmusic);
$totalRows_Allmusic = mysql_num_rows($Allmusic);
?>
<!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"> </div>

  <div class="content">
    <div class="content_resize">
      <div class="mainbar">
        <div class="article">
          <table width="642">
            <tr>
              <td width="110"> </td>
            </tr>
            <tr>
              <td><img src="<?php echo $row_Allmusic['album_image']; ?>"  width="100" height="100"/></td>
              <td width="516"><p>Album Title<?php echo $row_Allmusic['album_name']; ?></p>
                <p>Artist<?php echo $row_Allmusic['artist']; ?></p>
                <p>Genre<?php echo $row_Allmusic['genre']; ?></p>
                <p>Release Date<?php echo $row_Allmusic['release_date']; ?></p>
                <p>Price<?php echo $row_Allmusic['price']; ?></p></td>
            </tr>
            <tr>
              <td> </td>
            </tr>
            <tr>
              <td> </td>
            </tr>
            <tr>
              
            </tr>
          </table>
          <table width="587">
            <tr>
              <td width="577"><p>Tracklisting</p></td>
            </tr>
            <tr>
              <td><?php echo (nl2br($row_Allmusic['tracklisting'])); ?></td>
            </tr>
            <tr>
              
            </tr>
            <tr>
             
            </tr>
            <tr>
              
            </tr>
          </table>
          <table width="654">
            <tr>
              <td>Artist Info</td>
            </tr>
            <tr>
              <td><?php echo $row_Allmusic['artist_info']; ?></td>
            </tr>
          </table>
          <table width="653">
            <tr>
              <td>Album Description</td>
            </tr>
            <tr>
              <td><?php echo $row_Allmusic['album_description']; ?></td>
            </tr>
        </table></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>
Over 6,000+ Premium Web Templates</li>
            <li><a href="http://www.templatesold.com/">WHSmith Entertainment</a>
Premium WordPress & Joomla Themes</li>
            <li><a href="http://www.imhosted.com" title="Affordable Hosting">Jango</a>
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($Allmusic);
?>

 

Help would be very much appreciatted. Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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