j2
asked on
Accessin array outside function?
I have a fuction that pulls an array from a mySQL database for Joomla!
But, how do i access that array outside my fucntion? My code doesnt work, as $rows is "NULL" when i try to act on it outside the function.
But, how do i access that array outside my fucntion? My code doesnt work, as $rows is "NULL" when i try to act on it outside the function.
<?
defined('_VALID_MOS') or die('Direct access to this location not allowed');
getSessions();
//var_dump($rows);
foreach ( $rows as $row) {
echo "$row->title $row->session_up\n";
}
function getSessions(){
global $database;
$sql= "select * from #__events_sessions where title like 'Stamps%' and session_down > now() order by session_up limit 1";
$database->setQuery($sql);
$rows = $database->loadObjectList();
var_dump($rows);
// foreach ( $rows as $row ) {
// echo "$row->title $row->session_up\n";
// }
return $rows;
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
*groooooaaaaaaaaaan*
I CAN NOT beleive i did that....
I was sure my problem was that i screwed up in calling a class from Joomla! incorrectly.
I am so embarrased.
I CAN NOT beleive i did that....
I was sure my problem was that i screwed up in calling a class from Joomla! incorrectly.
I am so embarrased.
ASKER
Thanks heaps!
ASKER