Jump to content

Archived

This topic is now archived and is closed to further replies.

Miyk

MySQL Error...Help!

Recommended Posts

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

Share this post


Link to post
Share on other sites
Can you post the exact code for the query? It looks like MATCH() and AGAINST() aren't being passed the appropriate parameters.

See one of the following pages in the MySQL manual for more info (depending on which version of MySQL you're using):

4.1 and lower: http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html
5.0: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
5.1: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html

Share this post


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

Share this post


Link to post
Share on other sites

×

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.