Jump to content

Archived

This topic is now archived and is closed to further replies.

crazylegseddie

Compatibility issues!!

Recommended Posts

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?

[code]
$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";
}


?>
[/code]

Share this post


Link to post
Share on other sites

×

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.