Problem:
"1064 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 '-0, 0' at line 11"
This can also result in PCI scans failing.
Cause:
If you set any of the Admin->Configuration->Maximum Values to zero, the above situation may occur.
Fix:
There are a few ways to avert this situation:
a) Don't set Maximum Value settings to 0.
b) Change /includes/classes/split_page_results.php to detect 0 values and assign something different if that happens:
At line 25 find this section, and insert the new line as highlighted:
Code:
/* class constructor */
function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page', $debug = false) {
global $db;
$max_rows = ($max_rows == '' || $max_rows == 0) ? 20 : $max_rows;
$this->sql_query = $query;
$this->page_name = $page_holder;
c) Change /includes/classes/split_page_results.php to handle the "-0" situation more gracefully if it ever occurs:
At line 84, find this:
Code:
// fix offset error on some versions
if ($offset < 0) { $offset = 0; }
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
}
and change it to this:
Code:
// fix offset error on some versions
if ($offset <= 0) { $offset = 0; }
$this->sql_query .= " limit " . ($offset > 0 ? $offset . ", " : '') . $this->number_of_rows_per_page;
}
I recommend all three
Bookmarks