CodeIgniter Forums
Message: Undefined variable: x - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Message: Undefined variable: x (/showthread.php?tid=77545)



Message: Undefined variable: x - lapz_anry123 - 09-14-2020


.php   Produce.php (Size: 690 bytes / Downloads: 3) Hi I'm currently studying programming, and i came accross codeigniter mvc framework.

i made a small project and created a php display of what was in the database.

however i have a problem where i cannot get why codeigniter cannot see the variable that i created.

in the foreach loop of view and use the variable of view in another link and 
the error Message: Undefined variable: x.

i have attached my model / controller / and views. 

thanks for the help in advance.

regards,
Ryan


RE: Message: Undefined variable: x - Omar Crespo - 09-15-2020

Hello, in your controller, call the model in lowercase: $this->load->model('procedure');

In the view use the function empty($var).
Code:
if(!empty($recipes){
all your code
} else{
echo "Error, recipes var does not exist";
}



RE: Message: Undefined variable: x - lapz_anry123 - 09-16-2020

Thanks for the reply. i was able to solve my problem. it was only a assignment problem of the variable $x that was missing.