MyBB Community Forums

Full Version: SQL ERROR
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
SQL Error: 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 '-20, 20' at line 1 Query: SELECT * FROM mybb_banned ORDER BY dateline DESC LIMIT -20, 20

Hello! I believe I have some outdated Source Code for a plugin however I cant seem to understand this error?

define('IN_MYBB',1);
require_once('global.php');
define("PAGINATION",20);
$lang->load("modcp");
add_breadcrumb("Banned Users");
if(isset($mybb->input['asc'])) {
$options['order_dir'] = 'asc';
$ascdesc = '&asc';
$ascdesci = '&desc'; } else {
$options['order_dir'] = 'desc';
$ascdesc = '&desc';
$ascdesci = '&asc'; }


I believe it is talking about defining Pagination 20 however I cannot understand this. Could someone explain for me?
There is probably a bug in the pagination system, -20 is not an available start index for limit.
As the code is not complete, it's hard to help you, but I think that the offset is computed with something like "(N° of page * PAGINATION) - PAGINATION".
The case when N° of page is not sent (first page) is not well treated, PHP interpret the empty value like 0, it must be set to 1.