Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. FULLTEXT mysql search not working
  2. $query=mysql_query("SELECT * FROM comments WHERE MATCH (comments) AGAINST ('%$user_text%')");
  3.     while ($row=mysql_fetch_assoc($query)){
  4.         echo "<div>$row['comment']</div>";
  5.     }
  6.        
  7. CREATE TABLE `comments` (
  8. `id` int(11) NOT NULL...
  9.  
  10.  PRIMARY KEY (`id`),  //these are the last 3 lines
  11.  FULLTEXT KEY `comments` (`comment`)
  12. ) ENGINE=MyISAM AUTO_INCREMENT=93 DEFAULT CHARSET=latin1
  13.        
  14. SELECT * FROM comments WHERE MATCH (comments) AGAINST ('$user_text*' IN BOOLEAN MODE)"
  15.        
  16. SHOW CREATE TABLE comments;
  17.        
  18. "SELECT * FROM comments WHERE MATCH (questiontitle) AGAINST ('$user_text')"
  19.        
  20. "SELECT * FROM comments WHERE MATCH (questiontitle) AGAINST ('$user_text' WITH QUERY)" EXPANSION
  21.        
  22. ($row=mysql_fetch_assoc($query)