CodeIgniter Forums
variable from model to controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: variable from model to controller (/showthread.php?tid=44488)



variable from model to controller - El Forum - 08-16-2011

[eluser]Unknown[/eluser]
I am trying to pass a image file name from a model to a controller in order to add a record to my database (id,first_name,last_name,email). The image is not in a database. I upload the image but I can’t pass the variable from the model to the controller. When I turn the variable $file into a constant ($file=‘some_image’) it does work.

Thank you.


variable from model to controller - El Forum - 08-17-2011

[eluser]jvicab[/eluser]
you can pass values from a model function to a calling controller by returning it. If you have more than one value to be returned, you have two choices: or create a multiarray and returning it (like return $myarrayWink or using parameters passed by refrerence to model function.
Try not to use variable names that could be actually in used by codeigniter or php!