> I am using the below lines of code to save the 'project' module in my
> cakephp application. After saving the project module i like to
> retrieve the id,name of the project. The current save method is not
> returning the saved the row from database. (Note: I am 3 days old in
> Cake. Please apologize my mistakes)
> if ($this->Project->save($this->data)) {
> $this->set('savedProject', $this);
> $this->Session->setFlash('The Project has been saved');

save only returns true or false (the API would have answered this for you)

try:

if ($this->Project->save($this->data))
{
        $project_id = $this->Project->getLastInsertId();
        $savedProject = $this->Project->findById($project_id);
        
        $this->set('savedProject', $this);
        $this->Session->setFlash('The Project has been saved');
}

hth

jb

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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