This is probably something that's really easy to solve, but I just can't
figure it out.
I have a "settings" table, of the following structure:
CREATE TABLE `settings` (
`id` int(10) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index` (`name`)
);
I am fetching everything from it with the following code:
$q = $this->h->query("SELEC T name,value FROM settings");
return $q->fetchAll();
The thing is, the returned array goes in the format of $data[0]. I want
it to be like $data['test_setting'] (by the "name" column). How do I
accomplish this? I am using PDO::FETCH_ASSO C as the fetch mode.
Thanks
figure it out.
I have a "settings" table, of the following structure:
CREATE TABLE `settings` (
`id` int(10) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index` (`name`)
);
I am fetching everything from it with the following code:
$q = $this->h->query("SELEC T name,value FROM settings");
return $q->fetchAll();
The thing is, the returned array goes in the format of $data[0]. I want
it to be like $data['test_setting'] (by the "name" column). How do I
accomplish this? I am using PDO::FETCH_ASSO C as the fetch mode.
Thanks
Comment