Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/15254-mysql-errorhelp/
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
Link to comment
https://forums.phpfreaks.com/topic/15254-mysql-errorhelp/#findComment-61679
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
Link to comment
https://forums.phpfreaks.com/topic/15254-mysql-errorhelp/#findComment-61693
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.