I use a table to store all the config information:

CREATE TABLE `configs` (
  `id` int(10) unsigned zerofill NOT NULL auto_increment,
  `name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
  `value` text collate utf8_unicode_ci NOT NULL,
  PRIMARY KEY  (`id`)
)

and I have filled some config rows into this table, but when I want to
update one of them, like this:

<?php
class ConfigsController extends AppController
{
        var $name = 'Configs';
        var $scaffold;

        function edit($name)
        {
                $this->Config->id = $this->getIdByName($name);
                $this->data['Config'][$name] =
$this->params['data']['Config'][$name];
                $this->Config->save($this->params['data']['Config'], true, 
'name');
        }

        function getIdByName($name)
        {
                $array = $this->Config->find(array('name'=>$name));
                $id = $array['Config']['id'];
                return $id;
        }
}
?>

I always get these sql queries:

1       DESC `codehelper2_configs`
2       SELECT `Config`.`id`, `Config`.`name`, `Config`.`value` FROM
`codehelper2_configs` AS `Config` WHERE (`name` = 'cache') LIMIT
1               1       1       0
3       SELECT COUNT(*) AS count FROM `codehelper2_configs` WHERE (`id` =
0000000001)

there is apparently no UPDATE, why?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to