Is there a function where php sorts out the query putting the most keyword finds first and the least last?
PHP Code:
$query "SELECT * FROM bible WHERE 1=1 AND";
        
$query .= "(book_spoke = '".$_GET['spoke_select']."' OR chapter_spoke = '".$_GET['spoke_select']."' OR verse_spoke = '".$_GET['spoke_select']."') OR";
        
//$query .= "( CASE WHEN book_spoke = '".$_GET['spoke_select']."' THEN 1 ELSE 0 END + CASE WHEN chapter_spoke = '".$_GET['spoke_select']."' + CASE WHEN verse_spoke = '".$_GET['spoke_select']."' THEN 1 ELSE 0 END) AND";
    
        //to sort out all words with length less than 4 like AND, OR, BUT...
        
for ($i=0$i count($bigWords); $i++){
            if(
$bigWords[$i]!=""){
                
$query.=" CASE WHEN text_data LIKE '%" .$bigWords[$i]. "%' THEN 1 ELSE 0 END\n";
                if(
$i!=count($bigWords)-1){
                    
$query.=" +";
                    }else{
                    
//removes the OR from the last line and replaces with the following
                    //for results of words > 3
                    
$query.= " > 5";
                    }
                }
            }
        
$query .= " ORDER BY id"