Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 Pagination With Join and Where sql
#1

Hi there. For the first time with CI4 I need to use pagination but the explanations in our document or the examples I have found on internet lack when it comes to having an sql with joins or where conditions. Here is a simplified example of my Model and Controller. Could you please help how to convert it something that I can use with pagination.

My Model:

PHP Code:
public function get_all_offers_pending(){
    $db      = \Config\Database::connect();
    $builder $db->table('company_offers as co');
    $query $builder->select('*')
    ->join('companies as c''c.company_id = co.company_id')
    ->join('company_contact_info as cci''cci.company_id = co.company_id')
    ->join('sectors as s','s.sector_id  = c.sector')
    ->where('co.offer_status =''pending')    
    
->get();

    return $query->getResult();
  


My Controller:

PHP Code:
$data['offers_pending'] = $this->AdminLib->OfferModel->get_all_offers_pending(); 



Thanks in advance
Reply


Messages In This Thread
Codeigniter 4 Pagination With Join and Where sql - by demyr - 06-16-2022, 11:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB