Jump to content

Miyk

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by Miyk

  1. Miyk

    Search Error

    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
  2. 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 1 Query: 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 1 Query: 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
  3. Thanks for the response and the links, i will check those out, in the mean time here is the code from searchresults.php with the query form: [code] <form action="searchresults.php" method="get" id="searchForm">     <input type="hidden" name="num" value="9999" />     <input name="query" type="text" id="searchField"  onfocus="if(this.value=='Search')this.value='';" value="<?= $_REQUEST['query'] ? $_REQUEST['query'] : 'Search' ?>"  />     <input type="submit" name="Submit" value="GO" /></form> [/code] Thanks again! -mike
  4. I have a php/cms site that i am trying to port over to new hosting, I have ported over the mySQL tables ok, though I believe there is a differant version of mySQL on the new server....anyway, the only error i am recieveing is on the search function, when i try to search for anything, it avails this error: MYSQL ERROR in dbobj_count: You have an error in your SQL syntax near ') AGAINST('')' at line 1 Query: select count(*) from news_stories where MATCH() AGAINST('')MYSQL ERROR in dbjobj_join: You have an error in your SQL syntax near ') AGAINST ('') as cms_score from news_stories where MATCH() AGAINST ('') LIMIT 0' at line 1 Query: select *, MATCH() AGAINST ('') as cms_score from news_stories where MATCH() AGAINST ('') LIMIT 0, 9999999999 additionally, when i am logged into the admin area, and try to re-index all pages, it almost finishs but avails this warning in the header: Warning: fread(): Length parameter must be greater than 0. in /var/www/vhosts/vrroomedia.com/subdomains/staging/httpdocs/purelinegenetics/_admin/lib/cms_publish.php on line 155 here is the code that i believe the error may live in, which is in the 2 functions listed in the error message from dbobjects.php: [code] function dbobj_count($select) { if (! ($r = mysql_query($select))) { if ($err = mysql_error()) { echo "MYSQL ERROR in dbobj_count: $err<br>Query: $select"; return null; } } $row = mysql_fetch_row($r); return intval($row[0]); } [/code] and.... [code] function dbobj_join($select) {   if (! ($r = mysql_query($select))) {     if ($err = mysql_error()) {       echo "MYSQL ERROR in dbjobj_join: $err<br>Query: $select";       exit;     }     return false;   }   while ( ($row = mysql_fetch_array($r,MYSQL_BOTH))) {     $obj = new ReadOnlyDBObject();     foreach ($row as $k => $v)       $obj->$k = $v;     $objs[] = $obj;   }   return $objs; } [/code] Any help would be greatly appreciated! Thanks! -Mike
×
×
  • 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.