Jump to content

flannerz

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

flannerz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $q_music = mysql_query("SELECT *,".$database['prefix']."albums.id AS a_id FROM ".$database['prefix']."albums, ".$database['prefix']."tracks WHERE ".$database['prefix']."albums.status = '1' AND ".$database['prefix']."albums.id = ".$database['prefix']."tracks.track_album ORDER BY ".$database['prefix']."albums.name LIMIT $limitvalue,$limit ") or die(mysql_error()); $prevAlbum = ''; while ($MUSIC = mysql_fetch_object($q_music)) { if (!$MUSIC->a_id == $prevAlbum) { $find = array('{url}','{more_info}','{artist}','{album_title}','{tracks}','{image}'); $replace = array(($SETTINGS->mod_rewrite ? 'mp3-download/'.$MUSIC->a_id.'/'.addTitleToUrl(cleanData($MUSIC->artist)).'/'.addTitleToUrl(cleanData($MUSIC->name)).'.html' : 'index.php?cmd=album&album='.$MUSIC->a_id),$msg_music2,cleanData($MUSIC->artist),cleanData($MUSIC->name),str_replace("{count}",getTrackCount($MUSIC->a_id),$msg_music3),cleanData($MUSIC->image)); $prevAlbum = $MUSIC->a_id; } else { $find = array('{title}'); $replace = array((cleanData($MUSIC->track_name)); } endif $mData .= str_replace($find,$replace, file_get_contents(FOLDER_PATH.'templates/tpl_files/album_data.tpl') ); } I have tried to modify the code to reflect Barand's solution but I can't see to even get it to display anything now. Can anyone see where I am going wrong? Thanks
  2. Thanks for that Barand, but I'm unsure how I would integrate that into the code I have already got?
  3. My mistake before, it's not artists I'm trying to display, but Albums and then the tracks underneath. I think you could see I meant that though. Removing the group by gives the following result: Album 1 - Track 1 Album 1 - Track 2 Album 1 - Track 3 Whereas I want: Album 1 - Track 1 - Track 2 - Track 3 I am not just pulling across that data, also coming across is the ID, album image, artist. Besides this is the default statement that the system uses, a system I haven't developed. All I am doing is modifying it. Any ideas? Thanks
  4. Hi Guys I have a problem which I'm sure is pretty simple to solve but I just can't seem to get there myself! Here is the scenario: - First off, I am using an open source digital music downloads system which I am modifying to meet my clients needs. What they want on the music page is something very similar to the Juno website (http://www.juno.co.uk/all/this-week/) As you can see on that link, each artist has multiple tracks underneath them which can be previewed. This is something I am trying to achieve, however I have only been able to get 1 track to appear under the artist. So basically what I want to achieve is: Artist 1 - Track 1 - Track 2 - Track 3 Artist 2 - Track 1 - Track 2 Artist 3 - Track 1 - Track 2 - Track 3 It needs to display the data on one page in a list. I have been fiddling to extend the code below, but just keep getting errors. Below is the code that will let me display one record. I presume the track has to be in some kind of array to get it to display all the tracks belonging to that artist? <?PHP $q_music = mysql_query("SELECT *,".$database['prefix']."albums.id AS a_id FROM ".$database['prefix']."albums, ".$database['prefix']."tracks WHERE ".$database['prefix']."albums.status = '1' AND ".$database['prefix']."albums.id = ".$database['prefix']."tracks.track_album GROUP BY ".$database['prefix']."albums.name ORDER BY ".$database['prefix']."albums.name LIMIT $limitvalue,$limit ") or die(mysql_error()); while ($MUSIC = mysql_fetch_object($q_music)) { $find = array('{url}','{more_info}','{artist}','{album_title}','{tracks}','{image}','{title}'); $replace = array(($SETTINGS->mod_rewrite ? 'mp3-download/'.$MUSIC->a_id.'/'.addTitleToUrl(cleanData($MUSIC->artist)).'/'.addTitleToUrl(cleanData($MUSIC->name)).'.html' : 'index.php?cmd=album&album='.$MUSIC->a_id),$msg_music2,cleanData($MUSIC->artist),cleanData($MUSIC->name),str_replace("{count}",getTrackCount($MUSIC->a_id),$msg_music3),cleanData($MUSIC->image),cleanData($MUSIC->track_name)); $mData .= str_replace($find,$replace, file_get_contents(FOLDER_PATH.'templates/tpl_files/album_data.tpl') ); } ?> The data is then passed to a tpl file (hence why the system uses the replace function) and the following code is used to display the data <div class="albums"> <p class="view_more_info"><img src="{image}" title="{more_info}" alt="{more_info}" width="40" height="40" /></p> <div class="album_title"> <b><a href="{url}">{artist}</a></b><br />{album_title}<br /><i>{title}</i> </div> </div> The table structure for the two tables are as follows: CREATE TABLE mm_albums ( id INT(7) NOT NULL auto_increment, artist VARCHAR(250) NOT NULL default '', name VARCHAR(250) NOT NULL default '', image VARCHAR(250) NOT NULL default '', artwork VARCHAR(250) NOT NULL default '', comments MEDIUMTEXT NOT NULL default '', status ENUM('0','1') NOT NULL default '0', addDate DATE NOT NULL default '0000-00-00', keywords mediumtext not null default '', downloads INT(9) NOT NULL default '0', hits INT UNSIGNED NOT NULL default '0', rss_date VARCHAR(35) NOT NULL default '', PRIMARY KEY(id)) TYPE=MyISAM; CREATE TABLE mm_tracks ( id INT(9) NOT NULL auto_increment, track_name VARCHAR(250) NOT NULL default '', track_album INT(7) NOT NULL default '0', mp3_path VARCHAR(250) NOT NULL default '', preview_path VARCHAR(250) NOT NULL default '', track_length VARCHAR(50) NOT NULL default '', track_cost VARCHAR(5) NOT NULL default '', track_single ENUM('0','1') NOT NULL default '0', addDate DATE NOT NULL default '0000-00-00', track_order INT(9) NOT NULL default '0', downloads INT(9) NOT NULL default '0', PRIMARY KEY(id)) TYPE=MyISAM; The ID on the Albums table = track_album on the tracks table. I hope you understand what I'm trying to achieve and I can't imagine it is too difficult. I just can't for the life of me seem to be able to figure it out. Many thanks
  5. Many thanks for your help, you have answered most of my questions. One final question to bring it all together, what exactly would I need to put behind each of the boxes? (I mean the PHP code to process it). Thanks
  6. The table consists of the following fields: id date time competition round hometeam score awayteam attendance report What I want is for all of the fixtures/results from all competitions to be displayed initially. However I want a drop down which will be populated with the competitions and also one for the teams. I then want to be able to filter by either competition, round or team. Is this possible with this structure or not? Thanks
  7. Currently I just have the one table that is storing all of the data. I thought that I might be able to filter it out using WHERE clauses?
  8. Sorry to bump this topic but does anyone have a solution to this? Thanks
  9. Hi I'm not too sure how I can use a listbox/combo box (whatever you want to call it!) to filter out results. Here is the scenario: It is going to be used to display fixtures/results for around 4 of 5 competitions. There are various rounds that make up each competition Obviously there are going to be teams that play in the fixtures This is what I want: All data to be displayed in a table. So basically all fixtures and results for every competition/round/team Have three list boxes above the table where users can filter the results either by competition, round or team. I have no problem with getting the data into the database and pulling it all back into one table. However could someone instruct me with the code I will require to A) Populate the list boxes with the competitions/rounds/teams and B) Filters the results correctly when a user tries to use the filter. I'm sure it's not too difficult to do but I would really appreciate the code I would need or a link to place that will instruct me how to do it. Many thanks
  10. Can anyone help me with this?
  11. Hi Guys I seem to have a problem with this simple form handling script. The problem is that is seems to send correctly sometimes and then other times it doesn't send at all. Every test I have done has worked perfectly yet my client has said that sometimes people are using the form yet their details never actually arrive. Below is the code (private details blocked out). The address that it is been sent to is an '@tiscali.co.uk'. I'm wondering if this could be the problem. [code]<? $mailto = '******@tiscali.co.uk'; $subject = "Enquiry"; $formurl = "http://www.******.com/contactus.html"; $errorurl = "http://www.******.com/error.html"; $thankyouurl = "http://www.******.com/thankyoucontactus.html"; $name = $_POST['name']; $address1 = $_POST['add']; $address2 = $_POST['add1']; $town = $_POST['town']; $county = $_POST['county']; $postcode = $_POST['postcode']; $telephone = $_POST['telephone']; $email = $_POST['email']; $from = $_POST['from']; $to = $_POST['to']; $from1 = $_POST['from1']; $to1 = $_POST['to1']; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) {     header( "Location: $formurl" );     exit; } if (empty($name) || empty($telephone) || empty($email)) {    header( "Location: $errorurl" );    exit; } $name = strtok( $name, "\r\n" ); $email = strtok( $email, "\r\n" ); if (get_magic_quotes_gpc()) {     $comments = stripslashes( $comments ); } $messageproper =     "This message was sent from:\n" .     "$http_referrer\n" .     "------------------------- Enquiry -------------------------\n\n" .          "Contact name - " .     $name .     "\r\n" .     "Address Line 1 - " .     $add .     "\r\n" .     "Address Line 2 - " .     $add1 .     "\r\n" .     "Town/City - " .     $town .     "\r\n" .     "County - " .     $county .     "\r\n" .     "Postcode - " .     $postcode .     "\r\n" .     "Telephone - " .     $telephone .     "\r\n" .     "Email Address - " .     $email .     "\r\n" .     "I would prefer to stay from the " .     $from .     " to the " .     $to .     " or alternatively from the " .     $from1 .     " to the " .     $to1 .     "\r\n" .     "Other Information - " .     $comments .          "\n\n------------------------------------------------------------------\n"; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" ); header( "Location: $thankyouurl" ); exit; ?>[/code] I'm no expert in PHP so any pointers would be great Thanks
×
×
  • 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.