skip to Main Content

Fatal error: Cannot re-assign auto-global variable _GET in
/home/blunest/public_html/portal/application/models/Pagination_model.php
on line 62

The code on line 62 is

public function paginationInfo ($_GET,$numFound=0,$rows=ROWS) {

The complete function is

public function paginationInfo ($_GET,$numFound=0,$rows=ROWS) {
    $a = ' ';
    $currentPage=getVal($_GET,'start',0);
    if ($currentPage) {
        $page_of = (($currentPage) * (int)($rows));
        if ($page_of >= $numFound) {
            $page_of = $numFound;
        }
        $a.='<div id="paginationInfo" class=""> Showing '. ((($currentPage-1) * (int)($rows)) + 1) . ' to '. $page_of . ' of ' . $numFound . ' entries </div>';
    } else if ($numFound !== 0) {
        if ($rows >= $numFound) {
            $page_of = $numFound;
        } else {
            $page_of = $rows;
        }
        $a.='<div id="paginationInfo" class=""> Showing  1 to ' . $page_of . ' of ' . $numFound . ' entries </div>';
    }
    return $a;
}

Error Message!!

A PHP Error was encountered Severity: Compile Error

Message: Cannot re-assign auto-global variable _GET

Filename: models/Pagination_model.php

Line Number: 62

Backtrace:

Current PHP Version is 7.3

2

Answers


  1. You can think $_GET as a reserved keyword, so it cannot be used as an argument.( You can just remove that argument )

    Login or Signup to reply.
  2. remove the $_GET from the function parameter as it’s already declared as GLOBAL variable and you are again declaring it for a function. If you want to access it, just access it without the need of sending it as parameter

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search