Already done. It's not that easy...

Array
(
    [Request] => Array
        (
            [field2] => asdfsd
        )

)

No Id is set...

The value which is shown in the SQL Statement is only named in the
routes.php...



On 1 Jun., 17:18, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Look at pr($this->data)
>
> On Sun, Jun 1, 2008 at 9:22 AM, cronet <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > i have this routes defined:
>
> > Router::connect('/musiker/neu', array('controller' => 'requests',
> > 'action' => 'add', 'musician'));
> > Router::connect('/band/neu', array('controller' => 'requests',
> > 'action' => 'add', 'band'));
>
> > My Controller looks like this:
>
> > function add ($type) {
> >        $inputs = "";
> >        $url = "";
> >        $redirect = "";
>
> >        switch($type) {
> >                case "musician":
> >                        $inputs = array("field1");
> >                        $url = "/musiker/neu";
> >                        $redirect = "/musiker";
> >                        break;
> >                case "band":
> >                        $inputs = array("field2");
> >                        $url = "/band/neu";
> >                        $redirect = "/band";
> >                        break;
> >        }
>
> >        $this->set("inputs", $inputs);
> >        $this->set("url", $url);
>
> >        if( $this->data ) {
>
> >                if( $this->Request->save($this->data) ) {
> >                        $this->redirect($redirect);
> >                }
>
> >        }
> > }
>
> > Then this SQL Error pops up and an empty row was saved (except created
> > and modified fields):
>
> > SELECT COUNT(*) AS `count` FROM `requests` AS `Request` WHERE
> > `Request`.`id` = band   1054: Unknown column 'band' in 'where clause'
>
> > INSERT INTO `requests` (`modified`,`created`) VALUES ('2008-06-01
> > 14:20:14','2008-06-01 14:20:14')
>
> > Why cakePHP assumes that the first argument is the ID?
>
> > Regards,
> > Alexander
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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