/**
* Count total number of items matching the current WHERE conditions
*/
- public function count(): int
+ public function getnumrec(): int
{
$sql = "SELECT COUNT(*) AS cnt FROM {$this->table}";
public function goNext(): int
{
if ($this->limit !== null) {
- $this->offset += $this->limit;
- }
+ $last=max($this->getnumrec(),$this->limit);
+ $this->offset = min($last-$this->limit,$this->offset+$this->limit);
+ }
return $this->offset;
}
public function goLast(): int
{
if ($this->limit !== null) {
- $total = $this->count();
+ $total = $this->getnumrec();
$this->offset = max(0, $total - $this->limit);
}
return $this->offset;
$username=trim(($_POST['username']));
$rqst->where("email","like","%$username%");
}
-$numrec=$rqst->count();
+$numrec=$rqst->getnumrec();
if (isset($_POST['scanner'])) {
$scanner=$_POST['scanner'];
switch ($scanner) {