Welcome Guest, Not a member yet? Register   Sign In
model in view, or passing from view strange behavior
#5

(This post was last modified: 10-29-2019, 07:27 AM by Goddard.)

In the view, if you pass it an array. You can then use it in your view.

so if I loop over that array in my view, but I need to alter one value in the view for whatever reason I can use my model to change it.

view.php
-----------
foreach($db_object_array as $db_object){
echo $db_object_model->my_function($db_object);
}

When doing the above the result is still a $db_object_array inside "my_function"

Really you should be able to just do, $db_object->my_function() and get your value, but database results in CI3 are not actual models of your data structure and more of just a collection of SQL functions.
Reply


Messages In This Thread
RE: model in view, or passing from view strange behavior - by Goddard - 10-29-2019, 07:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB