Welcome Guest, Not a member yet? Register   Sign In
Message: Undefined variable: x
#1


.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

Attached Files
.php   Produces.php (Size: 958 bytes / Downloads: 6)
.php   recipe.php (Size: 598 bytes / Downloads: 4)
.php   recipes.php (Size: 1.16 KB / Downloads: 4)
Reply
#2

(This post was last modified: 09-15-2020, 10:42 AM by Omar Crespo.)

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";
}
Reply
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB