Hi,
I'm trying to make use of the printMostPopularItems() function in Zenpage. I'm having no luck as it just generates the following error:
`MySQL Query ( SELECT id, title, titlelink, hitcounter, total_votes, rating FROM `zp_zenpage_news` ORDER BY DESC LIMIT 10 ) failed. MySQL returned the error 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 'DESC LIMIT 10' at line 1`
This occurs on a FreeBSD box (Apache) running MySQL 5.0.51a and also a Windows box (Apache) running MySQL 5.1.30.
Unfortunately as I'm no MySQL guru I'm not sure where to start looking to debug it. Perhaps it'll be blindingly obvious to someone.
Cheers!
Comments
Is it a quick fix? As in, can I edit the function myself to get it working in my current installation?
Cheers
`
function getZenpageStatistic($number=10, $option="all",$mode="popular") {
global $_zp_current_zenpage_news, $_zp_current_zenpage_pages;
$number = sanitize_numeric($number);
switch($mode) {
case "popular":
$sortorder = "hitcounter"; break;
...
`
...and it now works
Thanks a lot for that, well spotted!
On a side note, it would be nice if the printZenageStatistic() that the printMostPopularItems() uses didn't add `$item['type']`, or at least gave the option to toggle, but that's something for another day I think. Given that I'm editing the functions page anyway I'll just delete it from there but in the future I'll put the php to use with getZenpageStatistic() directly in the theme.