• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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: 4)
.php   recipe.php (Size: 598 bytes / Downloads: 3)
.php   recipes.php (Size: 1.16 KB / Downloads: 3)
Reply

#2
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.