Miyk Posted July 22, 2006 Share Posted July 22, 2006 Hello I am having a problem with a search function written in PHP / MySql, here is there error:[color=red]MYSQL ERROR in dbobj_count: You have an error in your SQL syntax near ') AGAINST('test')' at line 1Query: select count(*) from news_stories where MATCH() AGAINST('test')MYSQL ERROR in dbjobj_join: You have an error in your SQL syntax near ') AGAINST ('test') as cms_score from news_stories where MATCH() AGAINST ('test')' at line 1Query: select *, MATCH() AGAINST ('test') as cms_score from news_stories where MATCH() AGAINST ('test') LIMIT 0, 9999999999[/color]I believe the error lies in here, but i can't seem to figure it out, the site has been ported over from other hosting, and i believe the version of mySql may be a bit differant, can it be a quote issue, since i believe differant versions of mysql are sensitive to that sort of syntax? :[code]function CMSTextSearchResults($format,$table = null) { $offset = (is_integer($_REQUEST['start']) ? $_REQUEST['start'] : 0); $limit = (is_integer($_REQUEST['num']) ? $_REQUEST['num'] : 9999999999); if ($table == null) { $tables = array_keys($GLOBALS['TEMPLATE']); $tables[] = 'cms_content'; } else $tables = array($table); $results = array(); foreach ($tables as $table) { $fields = join(",",_fulltextfields($table)); $returnStr = ''; // find number of rows total $count_qry = "select count(*) from $table ". "where MATCH($fields) AGAINST('$_REQUEST[query]')"; $GLOBALS['_numresults'] += dbobj_count($count_qry); // just return the subset asked for $qry = "select *, MATCH($fields) AGAINST ('$_REQUEST[query]') as cms_score ". "from $table where ". "MATCH($fields) AGAINST ('$_REQUEST[query]') ". "LIMIT $offset, $limit";[/code]Any help would be greatly appreciated thanks! ???-Mike Link to comment https://forums.phpfreaks.com/topic/15344-search-error/ Share on other sites More sharing options...
mainewoods Posted July 22, 2006 Share Posted July 22, 2006 where did you get that MATCH() function? I can't find it in the mysql manual:http://dev.mysql.com/doc/refman/5.0/en/ Link to comment https://forums.phpfreaks.com/topic/15344-search-error/#findComment-62214 Share on other sites More sharing options...
Miyk Posted July 23, 2006 Author Share Posted July 23, 2006 I myself didn't write the code, It was done a long time ago i guess, and the developer isn't available to help for some reason :-\ , but i did find the Match() function mentioned in the manual here:[url=http://dev.mysql.com/doc/refman/4.1/en/fulltext-restrictions.html]http://dev.mysql.com/doc/refman/4.1/en/fulltext-restrictions.html[/url]Thanks for the help! :)-mike Link to comment https://forums.phpfreaks.com/topic/15344-search-error/#findComment-62480 Share on other sites More sharing options...
448191 Posted July 23, 2006 Share Posted July 23, 2006 $fields is empty, as deducted from your errormessage: [b]from news_stories where [u]MATCH()[/u] AGAINST[/b]Read up on mysql's fulltext searching. Link to comment https://forums.phpfreaks.com/topic/15344-search-error/#findComment-62486 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.