• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cannot access query results in view: Message: Undefined variable

#2
[eluser]johnmerlino[/eluser]
This fix for this was assigning the object that resulted from result() in an associative array of an array object:

$data = $home->find('all');
$options['records'] = $data;

At that point, the associatve array become available as a variable in view and that variable held an object of key/value pairs from the query, so foreach can be used to iterate through the objects indexed in the array (e.g. $row->title).


Messages In This Thread
cannot access query results in view: Message: Undefined variable - by El Forum - 03-06-2011, 04:09 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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