Jump to content

skeezmo

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by skeezmo

  1. Thank you very much for your help. I will try this as soon as I can and I will update here. Hess
  2. The first part of this code (lines 1-19) are fetching album names from a list of tracks from a mysql database. The classes and functions shown are of the joomla CMS. This is all working fine and I can get the list of albums displayed. $artist is a variable in the URL. What I am then trying to do (line 20 to close tag #1) is to find the songs that correlate to that specific album and artist. Using the example of the database finding two albums or more albums is where we run into the problem. I can get the song lists for both and that is all successful. The thing is that (i dont know if this makes sense) but the arrays aren't differentiating between the different albums. So when I list the songs and albums on a later page (second php tag set) I get the same song listing for both albums. That is the problem. The DEBUG I have set up shows me that I am getting the song and album data correctly from the db, it just shows that both of the arrays are identified by the number zero and are then being lumped together. The album that is fetched second is the one whose songs are shown for both albums. <?php if(isset($artist)) { $query = 'SELECT DISTINCT album, picture FROM `songlist` WHERE artist = "'.rawurldecode($artist).'" ORDER BY album ASC'; $database->setQuery($query); $album_name = $database->LoadResultArray(0); $album_picture = $database->LoadResultArray(1); print_r($album_name); $this->assignRef( 'album_name', $album_name ); $this->assignRef( 'album_picture', $album_picture ); //Cycle through albums and get songlist //Find number of albums $query = 'SELECT COUNT(DISTINCT album) as num FROM `songlist` WHERE artist = "'.rawurldecode($artist).'" ORDER BY album ASC'; $database->setQuery($query); $numalbums = $database->LoadObject(); for ($x = 0, $n = $numalbums->num; $x < $n; $x++) { $query = 'SELECT title, ID FROM songlist WHERE artist = "'.rawurldecode($artist).'" AND album = "'.$this->album_name[$x].'" ORDER BY title ASC'; $database->setQuery($query); $songs = $database->LoadResultArray(0); $songIDs = $database->LoadResultArray(1); //DEBUG print_r($songs); echo '<br /><br />'; $this->assignRef( 'songs', $songs ); $this->assignRef( 'songIDs', $songIDs ); } } ?> <?php $h = 0; for ($j=0, $y=count( $this->album_name ); $j < $y; $j++) { $row =& $this->album_name[$j]; $row2 =& $this->album_picture[$j]; $script = 'window.addEvent(\'domready\', function(){ '; $script .= 'var mySlide'.$j.' = new Fx.Slide(\'slide'.$j.'\'); '; $script .= 'mySlide'.$j.'.hide(); '; $script .= ' $(\'toggle'.$j.'\').addEvent(\'mousedown\', function(e){ e = new Event(e); mySlide'.$j.'.toggle(); e.stop(); }); }); '; $document->addScriptDeclaration( $script ); //Find tracklist for album echo ' <tr> <td width="9%" valign="center">'; if(file_exists('components/com_radio/albumcovers/'.$dj.'/'.$row2)) { echo '<img src="components/com_radio/includes/phpThumb/phpThumb.php?src=../../albumcovers/'.$dj.'/'.$row2.'&w=35" />'; } else { echo '<img width="35px" height="35px">'; } echo '</td><td width="85%" valign="middle"> '.$row.'</td><td width="1%"></td><td width="5%" valign="middle"><a id="toggle'.$j.'" name="toggle'.$j.'" class="slideTitleLink"><span class="slideTitle">[+/-]</span></a> <tr><td colspan="3"> <div id="slide'.$j.'" class="slideBox" style="margin-left:50px;"> <table border="0"> '; for ($r=0, $q=count( $this->songs ); $r < $q; $r++) { echo '<tr><td width="100%"><a href="index.php?option=com_radio&view=songinfo&dj='.$dj.'&songID='.$this->songIDs[$r].'">'.$this->songs[$r].'</a></td><!--<td width="1%"></td><td width="3%">&#187;</td>--></tr>'; } echo ' </table> </div> </td></tr> </td> </tr>'; } ?> <?php } ?> This is what I get from the DEBUG part of my script: I think that the fact that both arrays are Array [0] is the problem. Would that make sense? Can anyone identify what the problem is and how I might be able to fix it? Thank you very much. Hess Smith
  3. Hello, I have a large list of songs and artists and I am creating a playlist.  At the top, I have the user select a letter which will then direct them to artists that start with that letter. The problem I am running into is for artists that start with a number should be going under a separate category [b]0-9 and '[/b].  But instead they are going as individual numbers in the list. The query I am running for this is:  [code]SELECT distinct substr(artist, 1,1) as browse FROM songlist WHERE songtype = "S" or songtype = "C" ORDER by artist asc[/code] I have tried adding into the where clause AND songlist.browse not like '1%') etc. My question is, can I run a query and exclude numbers from returning in the result? Does anyone have any suggestions that I could use to accomplish this? Thank you in advance to anyone who may be of help. Hess Smith
  4. I have an equality survey with multiple stages. These stages seem to be in the way of the data selected being put to variables. I have tried to implement as best I can the way to save the data to a variable with only one page of options, but this has truly stumped me. Does anyone here know how exactly I would go about doing this? Hess PS : The code is extremely long, so I have put it on this separate page as not to clutter up the forum. [a href=\"http://68.230.58.109:916/aero/source.txt\" target=\"_blank\"]Source Code[/a] You can also view the page if you wish here : [a href=\"http://68.230.58.109:916/aero/survey.php\" target=\"_blank\"]http://68.230.58.109:916/aero/survey.php[/a]
  5. I have found on php.net, [b]that sprintf("%01.2f", $money);[/b] will echon out to decimal place holders for currency. What I am looking for is for this to only take place if in the database there happen to be cents attached to the dollar. Otherwise, it just stays the same (no decimals). Does anyone know how I'd achieve this?
×
×
  • 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.