Right after install when I use the module for the first time, i.e. accessing My Interests (appears in the Navigation menu after the module installation), I see the following:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND i.uid != '1' AND i.uid != '0' AND u.uid = i.uid AND i.tid query: SELECT i.uid, i.tid, u.name, t.name AS tname FROM interests i, users u, term_data t WHERE () AND i.uid != '1' AND i.uid != '0' AND u.uid = i.uid AND i.tid = t.tid GROUP BY i.uid ORDER BY i.counter desc LIMIT 10 in D:\htdocs\VirtualHosts\mybiz2\includes\database.mysql.inc on line 167.

Source code analysis gave the following diagnosis: when the module tries to build a list of users with the same interests as mine, the situation when I don't have any interest yet is not taken into account (see empty brackets after WHILE in the SQL request?).

The function is interests_browse(). Lines 198 through 204:

$myTags = db_query("SELECT i.tid FROM {interests} i WHERE i.uid = '%s'", $user->uid);
while($row = db_fetch_array($myTags)){
$like .= "i.tid = '".$row['tid']."' OR ";
}
$like = rtrim($like, ' OR ');

$resultUsers = db_query("SELECT i.uid, i.tid, u.name, t.name AS tname FROM {interests} i, {users} u, {term_data} t WHERE ($like) AND i.uid != '%s' AND i.uid != '0' AND u.uid = i.uid AND i.tid = t.tid GROUP BY i.uid ORDER BY i.counter desc LIMIT 10", $user->uid);

See suggested patch in attachment.

CommentFileSizeAuthor
interests.module_0.patch417 bytesigvalor
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

igvalor’s picture

Title: The module reports error in SQL syntax, when you try to access My Interests for the 1st time » Oops! I submitted the same three times.

I submitted the same three times. Sorry. That were some problems with connection.

Taz’s picture

Status: Active » Closed (fixed)