CodeIgniter Forums
What is causing the "view" error in Codeigniter 4? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: What is causing the "view" error in Codeigniter 4? (/showthread.php?tid=87590)



What is causing the "view" error in Codeigniter 4? - SonopaalFounik - 05-07-2023

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 help me with that.


RE: What is causing the "view" error in Codeigniter 4? - kenjis - 07-03-2023

It seems no posts found.