Welcome Guest, Not a member yet? Register   Sign In
pagination
#1

How to use pagination through MySQL query instead of using just the Model name?
Controller code:
PHP Code:
namespace App\Controllers;
 
use 
CodeIgniter\Controller;
use 
App\Models\Model_pagination;
 
class 
Pagination extends Controller
{
    public function index()
    {    
        $model 
= new Model_pagination();
 
        $data = [
            'users' => $model->paginate(10),
            'pager' => $model->pager
        
];
        
        
return view('pagination'$data);
    
Model Code
PHP Code:
namespace App\Models;
use 
CodeIgniter\Database\ConnectionInterface;
use 
CodeIgniter\Model;
 
class 
Model_pagination extends Model
{
    protected $table 'users';
 
    protected $allowedFields = ['ID','unique_id_number''role'];


NOTE: Please help me out using MYSQL query with user defined JOINS or UNION etc instead of using just the table name in Model (Table: users here). I want to use userdefined queries instead of mere table name and allowed fields
Reply


Messages In This Thread
pagination - by purbaphalguni - 10-01-2020, 10:09 PM
RE: pagination - by nc03061981 - 10-02-2020, 03:34 AM
RE: pagination - by purbaphalguni - 10-02-2020, 03:47 AM
RE: pagination - by nc03061981 - 10-02-2020, 04:46 AM
RE: pagination - by purbaphalguni - 10-02-2020, 04:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB