Welcome Guest, Not a member yet? Register   Sign In
SQL join codeigniter 4
#1

(This post was last modified: 12-20-2022, 03:06 AM by SnowranCruzick.)

Codeigniter 4 is throwing the following error:

Argument 2 passed to view() must be of the type array, null given called in D:\xampp\htdocs\lordeCI\app\Controllers\Blog.php on line 35

That is about the block of code below:

public function post($post_id)
    {
        $model = new BlogModel();
        $posts = $model->select('*')->select('c1.nome as categoria, c2.nome as categoria_2')
            ->join('categorias c1', 'c1.categoria_id = posts.categoria', 'inner')
            ->join('categorias c2', 'c2.categoria_id = posts.categoria_2', 'inner')
            ->find($post_id);

        return view('posts/single_post',$posts);
    }
I am very grateful to who echatspin echatrandom help me with that.
Reply
#2

Check you SQL statement is correct:
dd($model->db->getLastQuery());
Reply




Theme © iAndrew 2016 - Forum software by © MyBB