Okay, I'm using GLOBALS to set some settings within my whole site
$tmp = $GLOBALS['_ODB']->query("SELECT * FROM `options`");
$GLOBALS['options'] = NameToTop($tmp->fetchAll(PDO::FETCH_ASSOC));
I have this as my query, then I use this function to put the returned data in an array
So I can call it by using $GLOBALS['settings']['setting1']
function NameToTop($arr)
{
$output = array();
foreach ($arr as $val) {
$output[$val['name']] = $val['value'];
}
return $output;
}
Then here is the settings table, I don't see why this is going wrong; I really need some help.
CREATE TABLE IF NOT EXISTS `options` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `options`
--
INSERT INTO `options` (`ID`, `name`, `value`) VALUES
(1, 'setting1', 'Name'),
(2, 'email', 'webmaster@gmail.com'),
(3, 'site_title', 'Title of Site'),
I'm getting
Call to a member function fetchAll() on a non-object