Strang SQL error with LIMIT -20,20 is causing a blank screen
-
Hi
I have the following SQL error on my website, most of the times its ok and sometime a blank screen is comming.
PHP error (mysql)
SELECT DISTINCT wp_ngg_pictures.* , GROUP_CONCAT(CONCAT_WS(‘@@’, meta_key, meta_value)) AS ‘extras’ FROMwp_ngg_pictures
LEFT OUTER JOINwp_postmeta
ONwp_postmeta
.post_id
=extras_post_id
WHERE (exclude
= 0) AND (galleryid
IN (2)) GROUP BY wp_ngg_pictures.pid ORDER BY ABS(sortorder
) ASC,sortorder
ASC LIMIT -20, 20The limit -20,20 is causing the problem.
Workarround is changing C_CustomTable_DataMapper_Driver_Mixin.php on line 98:
$limit = $this->_wpdb()->prepare(“LIMIT %d, %d”,$offset,$max);
changed into
$limit = $this->_wpdb()->prepare(“LIMIT %d, %d”,max(0, $offset),$max);Don’t know why -20 offset is generated.
Best ragards
Dennis
- The topic ‘Strang SQL error with LIMIT -20,20 is causing a blank screen’ is closed to new replies.