'10') "; //Base song type limiter for SAM - DO NOT REMOVE //## BUILD SEARCH QUERY ## // Get the search tearm from the navigation (GET) $dcat=strtolower($dcat); $ex_key=strtolower($ex_key); if ($dcat=="soundtrack") { $dcat="all"; $q_main .="AND genre ='soundtrack'"; } if ($dcat=="all") { $ex_key="phrase"; } //$search=str_replace("'","''",$search); //remove ' and replace with double '' for code compatibility $search=trim($search); //remove spaces from start & end if(!empty($search)) { //echo$search,"
"; //echo$ex_key,"
"; if($ex_key=="keyword")//check for keyword search { $kt=split(" ",$search);//split apart keywords while(list($key,$val)=each($kt)) //loop through keywords { if($val<>" " and strlen($val) > 0) //check keyword is not a space and >0 characters { $val=str_replace("'","''",$val); $q_sub .= "$dcat LIKE '%$val%' and ";} //build query string for each keyword, add 1 q_sub for each iteration of loop }// end of while loop $q_sub=substr($q_sub,0,(strLen($q_sub)-4)); //remove last 'and' from query build to make it valid $q_main .="AND ($q_sub)"; //final query equals all q_subs combined } else if ($ex_key=="phrase") //check for phrase search { $search=str_replace("'","''",$search); if ($dcat=="all") { $q_main .="AND (artist LIKE '%$search%') OR (album like '%$search%') OR (title like '%$search%')"; } else{ $q_main .="AND ($dcat LIKE '%$search%')"; } } //set query to look for whole phrase within selected category else if ($ex_key=="exact match") //check for exact match { $search=str_replace("'","''",$search); $q_main .="AND ($dcat ='$search')"; } //set query to look for exact word match. }//echo $q_main; //## SEARCH INDEX BY ALPHA ## if((isset($letter)) && (!$letter=="")) //check if letter is selected { $nextletter = chr($i++); //Nextletter is ascii+1 //echo $letter; //DEBUG show letter selected $i=ord($letter); //$i is ascii for letter selected, used for query limiter if($i >= 65 && $i <= 90) //if i is >= int(A) and <= int(Z) query artist with names beginning with $letter (wildcard search) {$q_main .= " AND (artist LIKE '$letter%') ";} else {$q_main .= " AND (artist NOT REGEXP '^[A-Z]') ";}// else query artist with names that don't start with A-Z (wildcard search for everything but a letter) //echo $q_main," ",$i; //DEBUG show query used, and number setting for i to see if it falls in range for alpha query $q_main .="AND NOT genre ='soundtrack'"; } else {$letter="";} //Blank out letter selection if ($genre=="soundtrack") {$q_main .="AND genre ='soundtrack'";} //########## =================== ################ //Calculate total $tmp = $db->params; //Save params for second query $db->open("SELECT count(*) as cnt FROM songlist $q_main "); $row = $db->row(); $cnt = $row["cnt"]; //Now grab a section of that $db->params = $tmp; //Restore params $db->open("SELECT * FROM songlist $q_main ORDER BY artist ASC, title ASC", $limit, $start); $first = $start+1; $last = min($cnt,$start+$limit); $rc = $start; $prevlnk = ""; $nextlnk = ""; if($cnt>0) { if(!isset($search)) { $search=""; } $searchstr = urlencode($search); $prev = max(0,$start-$limit); if($start>0) $prevlnk = "<< Previous"; $tmp = ($start+$limit); if($tmp<$cnt) $nextlnk = "Next >>"; } function PutSongRow6($song) { global $rc, $start, $darkrow, $lightrow; $rc++; $bgcolor = "#302226" ; if(($rc % 2)==0) $bgcolor = "#595454" ; PrepareSong($song); ?> .
RoyRadio
Category:
Match:
Results:
Search:
  
Browse by Artist Name:
$v "; } echo "# - "; ?> Reset Track List
  ( Showing )  
row()) PutSongRow6($song); ?>
  ( Showing )  
 
back to top