Jump to content

Viewing Specific Record


littlea5h

Recommended Posts

So im having trouble viewing a specific record from two pages, lyrics_albums.php and lyrics_songs.php I want to view a specific song from the list of albums showing. Im a noobie so please don't shoot me if i have uneccessary code in there. Here are my codes for both the pages:

 

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

$colname_Albums = "8";
if (isset($_GET['artist_id'])) {
  $colname_Albums = $_GET['artist_id'];
}
mysql_select_db($database_conn1, $conn1);
$query_Albums = sprintf("SELECT * FROM media WHERE artist_id = %s", GetSQLValueString($colname_Albums, "int"));
$Albums = mysql_query($query_Albums, $conn1) or die(mysql_error());
$row_Albums = mysql_fetch_assoc($Albums);
$totalRows_Albums = mysql_num_rows($Albums);

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% 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">
          <div class="clr"></div>
          <p> </p>
          <table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td> </td>
              <td>Albums</td>
            </tr>
            <tr>
              <td> </td>
              <td>
                  <?php do { ?>
                    <?php echo "<a href='lyrics_songs.php?st={$row_Albums['song_title']}'>{$row_Albums['album']} <br/> </a>"; ?>
                    <?php } while ($row_Albums = mysql_fetch_assoc($Albums)); ?>              </td>
            </tr>
          </table>
        </div>
        <div class="article">
          <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><br />
              Over 6,000+ Premium Web Templates</li>
            <li><a href="http://www.templatesold.com/">WHSmith Entertainment</a><br />
              Premium WordPress & 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> </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="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($Albums);


?>

 

lyrics_songs.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_Albums = "SELECT * FROM media ";
$Albums = mysql_query($query_Albums, $conn1) or die(mysql_error());
$row_Albums = mysql_fetch_assoc($Albums);
$totalRows_Albums = mysql_num_rows($Albums);

///////////////////////////////////////


$st = $_GET['song_title'];
$result = mysql_query("SELECT * FROM media,albums WHERE artist_id ='$st'");



///////////////////////////////////////


?>
<!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">
          <div class="clr"></div>
          <p> </p>
          <table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td> </td>
              <td>Song Title</td>
            </tr>
            <tr>
              <td> </td>
              <td><?php echo $row_Albums['song_title']; ?> </td>
            </tr>
          </table>
        </div>
        <div class="article">
          <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><br />
              Over 6,000+ Premium Web Templates</li>
            <li><a href="http://www.templatesold.com/">WHSmith Entertainment</a><br />
              Premium WordPress & 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> </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="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($Albums);

?>

 

I think the problem may be in the lyrics_songs.php page because when i hover over the album it shows the right song for that album but when it takes me to the page it only shows the same song for all of the albums.  :confused:

 

Help would be greatly appreciated, i've been working on this for days now and cant find the error  :'(

Link to comment
Share on other sites

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.