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

(This post was last modified: 04-14-2020, 03:07 AM by SigveR.)

Hello,

I have been trying to figure out how to set up pagination. I've read the documentation several times, but can't understand why it is not working. It should be simple from my understanding.

This is the error I'm receiving

PHP Code:
Argument 1 passed to CodeIgniter\Database\BaseResult::getResult() must be of the type stringnull givencalled in 

This is my controller at the moment:

PHP Code:
  public function my_listings() {
        $jobs = new \App\Models\Jobs();

        if (!$this->ionAuth->loggedIn())
        {
            return redirect()->to('/logg-inn');
        }

        $this->meta =
            (object)array(
                'site_name' => 'Lynt',
                'title' => 'Innstillinger',
                'description' => 'test',
            );

        $data = ([
            'meta' => $this->meta,
            'uri' => $this->uri,
            'session' => $this->session,
            'ionAuth' => $this->ionAuth,
            'validation' => $this->validator,
            'jobs' => $jobs->paginate(10)->get_users_jobs(),
            'pager' => $jobs->pager()->get_users_jobs(),

        ]);


        echo view("moonlanding/header_moonlanding"$data);
        echo view("moonlanding/userhome/my_listings"$data);
        echo view("moonlanding/footer_moonlanding"$data);

    

And my model:

PHP Code:
    public function get_users_jobs() {
        $this->categories = new \App\Models\Categories();
        $builder $this->db->table('jobs');
        $builder->select('*')
                ->join('users''users.id = jobs.jobs_u_id')
                ->join('categories''category_id = jobs.jobs_category')
                ->where('jobs_u_id ='$this->current_user->id);
        $builder->orderBy('jobs_id''desc');
        $query $builder->get();
        if ($builder->countAllResults() > 0)
        {
            return $query;

        } else {
            return false;
        }
    

It is working perfectly before trying to mess it up with adding the pagination. I appreciate any help on this.
Reply


Messages In This Thread
Problems with pagination - by SigveR - 04-13-2020, 04:06 PM
RE: Problems with pagination - by wdeda - 04-14-2020, 04:34 AM
RE: Problems with pagination - by Jenny425 - 07-02-2020, 08:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB