Just my 2 cents here but shouldn't this:
PHP Code:
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND calendarid = $calendarid AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
Be like this:
PHP Code:
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND calendarid = ".$calendarid." AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);