View Single Post
  #4 (permalink)  
Old 06-25-2008, 07:10 PM
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 247
I'm getting frustrated at this. This is not working:
PHP Code:
//paging
$page = isset($_GET['page']) ? $_GET['page'] : 1;  //or you can use the ternary operator 

//$resultspertpage = 10;
$perpage 10;// number of records per page
$end $page*$perpage// present page
$start=($page-1)*$perpage;
/******************************************************************************/
//$sql="SELECT count(*)totalrows  FROM bible WHERE 1=1 AND";
$sql="SELECT * FROM bible WHERE 1=1 AND";
$j=0;
//to sort out all words with length less than 4 like AND, OR, BUT...
for ($i=0$i count($searchTheseArr); $i++){
    if(
strlen($searchTheseArr[$i]) > 4){
        
$newSearchTheseArr[$j] = $searchTheseArr[$i];
//j renumbers the words of length 4 and up        
        
$j++;
    }
}
//sql searches only length 4 and up
for ($j=0$j count($newSearchTheseArr); $j++){
    
$sql.=" CASE WHEN text_data LIKE '%" .$newSearchTheseArr[$j]. "%' THEN 1 ELSE 0 END";
    
//$sql.=" text_data LIKE '%" .$newSearchTheseArr[$j]. "%'";
    
if($j!=count($newSearchTheseArr)-1){
        
$sql.=" +";
        
//$sql.=" OR";
    
}else{
//removes the OR from the last line and replaces with the following    
        
$sql.= " > 3";
        
$sql.= " LIMIT " $start ", " $perpage;
    }

Reply With Quote