It's a bit weird, especially that calling the same function to edit the 
record returns the proper id.

i use the same property with such syntax:

if ($this->Design->saveAll($this->data))
            {   
                $this->notify(2,$this->Design->id);           
                $this->redirect('/designs',null,true);
            }

works like a charm.

post results of
debug($this->Document)
placed inside the if().

also a free tip:
$this->set(compact('message', 'documentid')); will work with same effect 
as two separate set's.

[email protected] pisze:
> Hi I'm having an issue where when I insert a new document into the
> database I'm not getting the id of the new record back. The save
> function looks like this:
>
> function save() {
>         if($this->Document->save($this->data)){
>             $documentid = $this->Document->id;
>             $message = '"Save Sucessful"';
>             $this->set(compact('message'));
>             $this->set(compact('documentid'));
>             $this->render('save', 'ajax');
>         }
>     }
> I know the new record is saving to the database with an id as I can
> see the new record in the database. I am also getting an id back when
> I edit a document and save it using this function. I'm using the
> latest version of cake (1.2.3.8166).
>
> Any ideas where/what the problem is likely to be?
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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