Small PDO problem
- From: Sweetiecakes <x@xxxxx>
- Date: Fri, 31 Oct 2008 22:22:03 +0200
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("SELECT 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_ASSOC as the fetch mode.
Thanks
.
Relevant Pages
- Re: Creating new settings on the fly
... add userid to the primary key, but that kind of seems like overkill. ... I'd probably use the settings. ... dataGridViews to display data, and many of them have 10-20 columns ... database, but the program is not multiuser and all users would share ... (microsoft.public.dotnet.languages.vb) - Re: Small PDO problem
... I have a "settings" table, ... PRIMARY KEY, ... How do I accomplish this? ... I am using PDO::FETCH_ASSOC as the fetch mode. ... (comp.lang.php) - Re: Violation of primary key
... I can't think of an accidental server or database setting change that would ... Did you make any design changes to your 'keycode' table (primary key)? ... I checked the settings but nothing seems ... (microsoft.public.sqlserver.server) - AutoNumber Random Number not Random
... I have a table structure that uses "Autonumber" for the ... data type (primary key) with the field size and new value ... settings as "Long Integer" and "Random." ... (microsoft.public.access.tablesdbdesign) - Re: Violation of primary key
... You can prove this with a query like: ... primary key values of the data you are trying to insert and either skip the ... > to have deleted but I cannot find the one that is trunkating my database. ... I checked the settings but nothing seems ... (microsoft.public.sqlserver.server) |
|