Jump to content


Photo

Compatibility issues!!


  • Please log in to reply
No replies to this topic

#1 crazylegseddie

crazylegseddie
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 20 August 2006 - 03:08 PM

I just tested my script on the real server and just realised they use a version of sql that does not support boolean mode searches  is it possible to edit the script below to not use boolean searches? If I remove the 'BOOLEAN MODE' from the script i receive the following message:

'Can't find FULLTEXT index matching the column list '

Any advise on this new problem will be great?

$searchwords = (isset($_GET['words']) ? htmlspecialchars(stripslashes($_REQUEST['words'])) : ''); 
   echo '<div align="right">'; 
   echo '<form method="get" action="'.$_SERVER['PHP_SELF'].'">'; 
   echo '<input type="hidden" name="cmd" value="search" />'; 
   echo '<input type="text" name="words" value="'.$searchwords.'" /> '; 
   echo '<input type="submit" value="Search" class="box" />'; 
  echo '</form>'; 
  echo '</div>';
} 

// Create the navigation switch 
$cmd = (isset($_GET['cmd']) ? $_GET['cmd'] : ''); 
switch($cmd) 
{ 
  default: 
      searchForm(); 
     break; 
     echo '<b>Search Results:<br><br>'; 
     
    $searchstring = mysql_escape_string($_GET['words']); 
  
        $sql = "SELECT pd_id, pd_name, pd_more, pd_more2,  
               MATCH(pd_name, pd_more, pd_more2)  
               AGAINST ('$searchstring' IN BOOLEAN MODE) FROM tbl_product
               WHERE MATCH(pd_name, pd_more, pd_more2)  
               AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY pd_name DESC"; 
     }    
     $result = mysql_query($sql) or die (mysql_error()); 
	 $num_of_rows = mysql_num_rows($result);

if ($num_of_rows > 0)
{

	   
   while($row = mysql_fetch_assoc($result)) 
    { 
      echo "<a href='categories.php?c=0&p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row['pd_name'])).'</a><br />'; 
      } 
	}
else
{
echo "<i>No results found, please try another search";
}

	
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users