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
[code]<?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); ?> iWebsiteTemplate.comBrowse by Artist
Sidebar Menu
- Home
- My Account
- Music Lyrics
- Gallery
- Artists Details
- Latest News
- Single Chart
- Album Chart
Sponsors
-
HMV
Over 6,000+ Premium Web Templates -
WHSmith Entertainment
Premium WordPress & Joomla Themes -
Jango
Affordable Web Hosting Provider
lyrics_artists.php
[code]<?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; } } ?> HomeTemplate License
Albums | |
<?php echo $row_Lyrics1['album']; ?> |
Sidebar Menu
- Home
- My Account
- Music Lyrics
- Gallery
- Artists Details
- Latest News
- Single Chart
- Album Chart
Adverts/Polls/Charts
Sponsors
<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>
mysql_free_result($Recordset1);
?>[/code]
Help would be much greatly apprecciated! Thanks