Yes, this works. Thank you for the hint!

But it would be interesting for me why cakePHP behaves that way ?!

Regards,
Alexander


On 2 Jun., 05:59, Sergei <[EMAIL PROTECTED]> wrote:
> Hi, try this:
>
> if( $this->data ) {
>
> $this->Request->id=""; // insert this line
>
>                 if( $this->Request->save($this->data) ) {
>                         $this->redirect($redirect);
>                 }
>
>         }
>
> On 2 июн, 06:50, cronet <[EMAIL PROTECTED]> wrote:
>
> > Quite simple:
>
> > <?php
> >         class Request extends AppModel {
> >                 var $name = "Request";
>
> >                 var $validate = array(
> >                     'feld1' => array("rule" => VALID_NUMBER, 'message' 
> > =>'Zahlen'),
> >                     'feld2' => array("rule" => '/^[a-zA-Z ]+$/', 'message'
> > =>'Buchstaben')
>
> >                   );
> >         }
> > ?>
>
> > Regards,
> > Alexander
>
> > On 1 Jun., 22:57, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > > And how are definded the models?
>
> > > On Sun, Jun 1, 2008 at 1:51 PM, cronet <[EMAIL PROTECTED]> wrote:
>
> > > > 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