littlea5h
Members-
Posts
13 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
littlea5h's Achievements
Newbie (1/5)
0
Reputation
-
str_replace function not working correctly
littlea5h replied to littlea5h's topic in PHP Coding Help
With this code... Computer Systems in URL: Array ( [0] => [1] => systems[2] => computer-systems [3] => ) 1 Commun/networking in URL: Array ( [0] => [1] =>systems [2] => commun-networking [3] => ) 1 -
str_replace function not working correctly
littlea5h replied to littlea5h's topic in PHP Coding Help
Does not work as search and replace works backwards for some reason :s -
str_replace function not working correctly
littlea5h replied to littlea5h's topic in PHP Coding Help
Thanks a bunch! I tested it for the '/' and it worked like a charm but i needed it for the space aswell, so after fiddling around,i put it inside an array again and I changed it to this: $char = array("/"," "); $name = str_replace("-", $char, $request[2]); $id = $category->find_id_by_name($name); However it doesnt work either, displays that error i stated above so i used the index to get the forward slash and it worked: e.g $name = str_replace("-", $char[0], $request[2]);<-- works for forward slash but not space $name = str_replace("-", $char[1], $request[2]);<-- works for space but not forward slash I just can't seem to get them to work together!! And from your example you have shown me, $request[2] is not shown but this is needed as this is where the data is, it would really help me out much if my code above was used -
So i am trying to replace spaces and forward slashes in a url with a hyphen. Say we have a website named: www.example.com/car/bmw/porsche where bmw/porsche is one value I can seem to get it to work for a space but having trouble with the forward slash. This is what i have for the space (yes i know the search and replace are at opposite ends but it seems to work and doesn't work if i swap them round) $name = str_replace("-", " ", $request[2]); $id = $category->find_id_by_name($name); I tried a number of ways to make it work but it still doesn't seem to want to listen.. these are the ways i have tried but neither work: 1. $name = str_replace("-", array(" ", "/"), $request[2]); $id = $category->find_id_by_name($name); 2. $chars = array(" ", "/"); $name = str_replace("-", $chars, $request[2]); $id = $category->find_id_by_name($name); Both which produce the error:- Notice: Array to string conversion 3. $name = str_replace(array("-","//"), " ", $request[2]); $id = $category->find_id_by_name($name); In the above code, space works but not the forward slash. Tried changing the forward slash to a single one, single quotes with both one and two slashes but still nothing. I have spent a good couple of hours fiddling around with it but nothing seems to work
-
So i have a car database storing parts for cars and i am in the process of creating a page which will store unique data for each car part chosen from another page(not yet created), at the moment i am just testing via the URL. This may be clear to me in the form of flat PHP but i am creating it with an MVC framework which makes it all the more complicated, i am still a noob in this area. Well the page which stores the unique data has two drop down menus for that particular part, such as the vehicle model and vehicle brand. I have created the view page, but it is the controller i am having the problems for. The other problem now is that there is way too much code for this to post here and they all connect together but im thinking if ur a PHP pro, you may have some general idea of how to go about this without looking at all the code?This is what i have for my controller so far: class CarController extends Zend_Controller_Action { public function indexAction(){ $category = new Application_Model_CarMapper(); $gcat = $this->getRequest()->getPathInfo(); //get id $id = $category->find_id_by_name($gcat); $this->view->title = $category->get_sub_cat_select($id); } } And it comes from the following query: public function find_id_by_name($name){ $select = $this->getDbTable()->query("SELECT * FROM car_category WHERE category_name = '{$name}'"); $result = $select->fetchAll(); if(!$result) { return; } return $result[0]["ID"]; } It is the controller class i am looking to change rather than the query itself. I am testing it out by the title but it just doesnt seem to display at all. I would like it to display the drop down menus for the specific category, e.g car-live.local/cars/Volvo ---> "Welcome to the Volvo Car Finder" car-live.local/cars/BMW ---> "Welcome to the BMW Car Finder" I know it is not working as i have to split down the URL even more, as right now it is finding the id via the URL, but i am unsure how to do this :s Any light you can shed on this would be extremely grateful.. Thanks.
-
I have tried to alter the code to a fulltext search. As i stated previously, the code i posted earlier was not fulltext as i have not come across the method. I changed the code to this however it still doesnt seem to be working. It just displays the message that shows up to the user that they can not find the keyword. $statement_front = "SELECT * FROM p2_parts p INNER JOIN p2_parts_category c ON p.partNumber = c.partNumber WHERE"; $sql = $statement_front." MATCH (p.manufacturer,p.description) AGAINST ('+{$description} IN BOOLEAN MODE') AND p.description LIKE '%{$description}%' OR c.category LIKE '%{$description}%' LIMIT 200"; $select = $db->query($sql); $results = $select->fetchAll(); Instead of the user wanting to type in the full keyword, i would like it so that they would only enter part of a keyword so it shows something similar. E.g 'key' would display 'keyboard' or 'board' would display 'motherboard, 'keyboard' etc
-
Hey guys, i am trying to implement this piece of code around a full text search but i havent worked with them before. I want that the user doesnt have to enter all of the keyword entered, so they can type half the keyword and it will still display the result. This is what i have so far! public function fetchAllByDescription($description){ $db = Zend_Db_Table::getDefaultAdapter(); $statement_front = "SELECT * FROM p2_parts p INNER JOIN p2_parts_category c ON p.partNumber = c.partNumber WHERE"; $sql = $statement_front." p.description LIKE '%{$description}%' OR c.category LIKE '%{$description}%' LIMIT 200"; $select = $db->query($sql); $results = $select->fetchAll(); if (0 == count($results)) { return; } $products = array(); foreach($results as $r) { if(isset($r['ID'])){ $products[] = $this->find($r['ID']); } } return $products; } Any help would be appreciated. Thanks!
-
Nope, it's not hosted publically just on my local machine
-
Yes, its in the lyrics_albums page code: <?php echo "<a href='lyrics_songs.php?st={$row_Albums['song_title']}'>{$row_Albums['album']} <br/> </a>"; ?>
-
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. Help would be greatly appreciated, i've been working on this for days now and cant find the error :'(
-
One page System...linking Artists to specific albums
littlea5h replied to littlea5h's topic in PHP Coding Help
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 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 -
One page System...linking Artists to specific albums
littlea5h replied to littlea5h's topic in PHP Coding Help
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? -
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]