Jump to content

Compatibility issues!!


crazylegseddie

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.