Toggle Content

Donations

Donate with PayPal!
Help support Pro_News and become a member of our Sponsors Group
The tip jar is at PayPal, but does not require a PayPal account
Anonymous $ 10.00
macavity $ 115.00
RedGerry £ 50.00
Anonymous $ 10.00
minor $ 20.00

Recommended ISP

Stop Software Patents

stopsoftwarepatents.eu petition banner

Link this Site

http://layingback.net Check our QR links

SQL Error

3.3 Forum ONLY: If you've run into a problem, such as an error message, blank page, or similar problem, this is where to look. Post any installation or other problems or questions here, and I and other users will try to help.
Reply to topicReply to topic Printer Friendly Page

SQL Error

Post Posted: Tue Sep 14, 2010 11:54 am

Bizzarely, now I have added a few more sections I am getting an SQL error on my home page:

On /~mouygite/dragonfly/index.php
While executing query "SELECT a.id aid, a.* FROM cms_pronews_articles as a JOIN cms_pronews_cats as c ON a.catid=c.id WHERE a.catid= AND a.approved="1" AND a.active="1" AND display<>"0" AND (alanguage='english' OR alanguage='') ORDER BY display_order DESC, posttime DESC LIMIT 5"

the following error occured: 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 a.approved="1" AND a.active="1" AND display<>"0" AND (alanguage='english' OR' at line 1

In: /home/mouygite/public_html/dragonfly/modules/Pro_News/functions.php on line: 2022



Interestingly enough when I look at the SQL queries on the page it shows the a.catid as being set?

0.0001 - LINE 2022: SELECT a.id aid, a.* FROM cms_pronews_articles as a JOIN cms_pronews_cats as c ON a.catid=c.id WHERE a.catid=3 AND a.approved="1" AND a.active="1" AND display<>"0" AND (alanguage='english' OR alanguage='') ORDER BY display_order DESC, posttime DESC LIMIT 5



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.17/9.3.3.1

rosbif
BetaTester
BetaTester
 
Posts: 492
Joined: Aug 01, 2007
Location: Chantilly, France

Re: SQL Error

Post Posted: Tue Sep 14, 2010 12:16 pm

Now I've added some categories to the sections that error has gone away. Is that normal?



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.17/9.3.3.1

rosbif
BetaTester
BetaTester
 
Posts: 492
Joined: Aug 01, 2007
Location: Chantilly, France

Re: SQL Error

Post Posted: Tue Sep 14, 2010 1:40 pm

If you can easily repeat - say by adding a new Section without a Category - and do whatever you were doing to trigger the error, can you test if this fixes it please?

Around line 1945 look for:

PHP:
        if ($pnsettings['display_by'] == '2') {
$sql .= ' LEFT JOIN '.$prefix.'_pronews_cats as c ON c.sid=s.id AND secdsplyby<>"1"';
} else {
$sql .= ' LEFT JOIN '.$prefix.'_pronews_cats as c ON c.sid=s.id AND secdsplyby="2"';
}


and then remove the 2 words LEFT.

I think I'm returning Sections without Categories and thus getting errors when the newer display modes (List by Section/Category/Articles) does a selection based on Category value. Hopefully this will just ignore them.

TIA.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback
Site Admin
Site Admin
 
Posts: 1229
Joined: Mar 18, 2006

Re: SQL Error

Post Posted: Tue Sep 14, 2010 2:19 pm

Will do - may not be for a day or two as real work intervenes again!



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.17/9.3.3.1

rosbif
BetaTester
BetaTester
 
Posts: 492
Joined: Aug 01, 2007
Location: Chantilly, France

Re: SQL Error

Post Posted: Tue Sep 14, 2010 2:44 pm

S'Ok, I managed to reproduce, and fix works ok, and doesn't appear to have any unwanted effects, so moving to release.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback
Site Admin
Site Admin
 
Posts: 1229
Joined: Mar 18, 2006
Link  QR  Share this Printer Friendly Page  facebook   myspace   twitthis  
Show more ...
Display posts from previous:   
Reply to topicReply to topic Page 1 of 1

3.3 Support

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

All times are GMT






layingback Non-Human Terms of Use