Jump to content

search returns: Can't find FULLTEXT index matching the column list


lilwing

Recommended Posts

using the source from the tutorial on this website, i have attempted to make a search for a table on one of my  mysql databases.

 

it returns "Can't find FULLTEXT index matching the column list"

 

not sure what it means, i googled for it and searched from problems, i can't find the problem!

 


<html>
<head><title>Search</title></head>
<body>

<?php

//vars for host username password db table and all that junk

// Full-Text Search Example
// Conect to the database.
$cnx = mysql_connect($host, $username, $password) or die ("Could not connect");
mysql_select_db($db,  $cnx) or die (mysql_error());

// Create the search function:

function searchForm()
{
  // Re-usable form
  
  // variable setup for the form.
  $searchwords = (isset($_GET['words']) ? htmlspecialchars(stripslashes($_REQUEST['words'])) : '');
  $normal = (($_GET['mode'] == 'normal') ? ' selected="selected"' : '' );
  $boolean = (($_GET['mode'] == 'boolean') ? ' selected="selected"' : '' );
  
  echo '<form method="get" action="'.$_SERVER['PHP_SELF'].'">';
  echo '<input type="hidden" name="cmd" value="search" />';
  echo 'Search for: <input type="text" name="words" value="'.$searchwords.'" /> ';
  echo 'Mode: ';
  echo '<select name="mode">';
  echo '<option value="normal"'.$normal.'>Normal</option>';
  echo '<option value="boolean"'.$boolean.'>Boolean</option>';
  echo '</select> ';
  echo '<input type="submit" value="Search" />';
  echo '</form>';
}


// Create the navigation switch
$cmd = (isset($_GET['cmd']) ? $_GET['cmd'] : '');

switch($cmd)
{
  default:
    echo '<h1>Search Database!</h1>';
    searchForm();
  
  break;
  
  
  case "search":
    searchForm();
    echo '<h3>Search Results:</h3><br />';
    
    $searchstring = mysql_escape_string($_GET['words']);
    switch($_GET['mode'])
    {
      case "normal":
        $sql = "SELECT id, updated_by, updated_on, pagecontent, //these are in my database
               MATCH(updated_on, updated_by, pagecontent) //i think the problem is in this switch
               AGAINST ('$searchstring') AS score FROM $table 
               WHERE MATCH(updated_by, updated_on, pagecontent) 
               AGAINST ('$searchstring') ORDER BY score DESC";
      break;
      
      case "boolean":
        $sql = "SELECT id, updated_by, updated_on, pagecontent, 
               MATCH(updated_on, updated_by, pagecontent) 
               AGAINST ('$searchstring' IN BOOLEAN MODE) AS score FROM $table 
               WHERE MATCH(updated_on, updated_by, pagecontent) 
               AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY score DESC";
      break;
    } 
    
    // echo $sql;
    
    $result = mysql_query($sql) or die (mysql_error());
    
    while($row = mysql_fetch_object($result))
    {
      echo '<strong>Date created: '.stripslashes(htmlspecialchars($row->updated_on)).'</strong><br />';
      echo '<p>'.stripslashes(htmlspecialchars($row->pagecontent)).'</p>';
      echo '<hr size="1" />';
    }
  break;
}
?>

</body>
</html>

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.