fixed datatable query

This commit is contained in:
2023-10-18 09:56:23 +07:00
parent def07c4e6f
commit 3eefdd8319
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -252,13 +252,13 @@ final class Table {
$t_order = ($i_order[0]['dir']=="asc") ? "ASC" : "DESC";
$i_order = $i_order[0]['column'];
}
if ($i_length > $record) $i_length = -1;
if (($i_length > $record) || (($i_start+1) >= $record)) $i_length = -1;
$sql_limit = ($i_start>=0 && $i_length != -1) ? " LIMIT ".$i_start.", ".$i_length : "";
$sql_order = ($this->__afield[$i_order]) ? " ORDER BY ".$this->__afield[$i_order]." ".$t_order : "";
$adata['data'] = [];
$this->__cdb->Query("SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit);
//$adata['sql'] = "SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit;
$adata['sql'] = "SELECT ".$this->__tfield." FROM ".$this->__ttable.$this->__twhere.$sql_order.$sql_limit;
while ($this->__cdb->Next()) {
$abaris = [];
$aoption = ['button'=>[]];