I see this when I go to the External Link Popularity Log:

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 'DISTINCT(n.nid), n.title, p.url, u.name, p.hostname, p.timestamp FROM pop_links_' at line 1 query: SELECT p.cid, DISTINCT(n.nid), n.title, p.url, u.name, p.hostname, p.timestamp FROM pop_links_stats p LEFT JOIN users u ON u.uid = p.uid LEFT JOIN node n ON n.nid = p.nid LEFT JOIN drigg_node dn2 ON dn2.dnid = n.nid WHERE ( 1=1 AND !(n.type='drigg' AND dn2.killed=1 ) ) AND ( !(n.type='drigg' AND n.created > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) ) ) ORDER BY p.timestamp DESC LIMIT 0, 30 in /home/sitename/public_html/includes/database.mysql.inc on line 172.

The module had been working properly for over a month and then I suddenly started getting this problem

CommentFileSizeAuthor
#2 pop_links-324473-3.patch1.24 KBsikjoy

Comments

sikjoy’s picture

Status: Active » Postponed (maintainer needs more info)

Hi Lukas2000:

Some of this SQL I recognize, but other parts of it seem to be from the Drigg module. For example, I don't know why there is a LEFT JOIN to drigg_node. I don't reference drigg_node anywhere in my code. Also the DISTINCT function isn't used anywhere in my code. Perhaps Drigg is using hook_db_rewrite_sql to alter my query?

I'll have a look at the Drigg code to see if anything is going on there.

You mentioned that it was working for a month. Has anything changed recently? Any module upgrades?

Best,

sicjoy

sikjoy’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.24 KB

Hi Lukas2000:

Ah, indeed Drigg is inserting its own SQL, but the mistake is mine. Try this patch. It should fix the problem.

Please reply letting me know if it works.

Best regards,

sicjoy

taqwa’s picture

It worked! Thanks SicJoy!

btw, I forgot to thank you for another issue that you helped me with a few weeks ago. Please don't take my absentmindedness to mean that I don't appreciate your help.

Thanks again!

sikjoy’s picture

Status: Needs review » Fixed

Awesome!

You're welcome.

--sicjoy

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

diesel7’s picture

how do I use this patch and where? I get this error when I try to submit a scoop, thx

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 n.status = 1 AND n.promote=0 AND n.type='drigg' ) ORDER BY vc.value DESC LI' at line 1 query: SELECT * FROM node n LEFT JOIN votingapi_cache vc ON vc.content_id=n.nid LEFT JOIN term_node t ON n.nid = t.nid WHERE ( 1=1 ) AND ( 1 = 1 AND vc.content_type = 'node' AND vc.value_type = 'points' AND vc.tag = 'vote' AND vc.function = 'sum' AND n.type='drigg' AND n.created > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - 60*60*48 AND t.tid= AND n.status = 1 AND n.promote=0 AND n.type='drigg' ) ORDER BY vc.value DESC LIMIT 5 in /home/moksiru/public_html/includes/database.mysql.inc on line 174.

diesel7’s picture

how do I use this patch and where? I get this error when I try to submit a scoop, thx

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 n.status = 1 AND n.promote=0 AND n.type='drigg' ) ORDER BY vc.value DESC LI' at line 1 query: SELECT * FROM node n LEFT JOIN votingapi_cache vc ON vc.content_id=n.nid LEFT JOIN term_node t ON n.nid = t.nid WHERE ( 1=1 ) AND ( 1 = 1 AND vc.content_type = 'node' AND vc.value_type = 'points' AND vc.tag = 'vote' AND vc.function = 'sum' AND n.type='drigg' AND n.created > UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - 60*60*48 AND t.tid= AND n.status = 1 AND n.promote=0 AND n.type='drigg' ) ORDER BY vc.value DESC LIMIT 5 in /home/moksiru/public_html/includes/database.mysql.inc on line 174.

sikjoy’s picture

You shouldn't need this patch any more.

Which version of External Link Popularity are you using?

--sicjoy

diesel7’s picture

sorry I didnt notice that this is actually for different module than what Im having problem with, my module that is causing this error is drigg autovoting