I have an error when showing my view the table with information in my database, it says Warning: foreach() argument must be of type array|object, null given in C:\xampp\htdocs\bemira\example\module \Application\view\tests\index.phtml on line 21 is exactly where the for each appears, but in my controller I already sent the var

Here the index

Hi Emma,

seems like $tasks is null. Check the return value of $this->table->fetchAll(). The fetchAll method returns a null value.

hI ezkimo
thank you so much for reply me, but still don’t know how to resolve it, i did a condition and i notice that is a null value, but how i convert null to string o something like that?

Do not put more logic into your template. You should resolve that issue in your controller or refactor the fetchAll method in your table class, that it returns an empty array or at least a traversable instead of a null value.

The issue was she changed the config for the view manager trying to get a view to display, but the actual issue was the controller had not been routed too. Which means she was treating the symptom and not the cause. I helped the user via slack to resolve that and many other issues. Namely that her server setup was wrong at the docroot level, which was causing all kinds of issues. Her project is now complete.