Re: save data from ONE form to TWO models

2006-08-25 Thread andru
$this-Answer-User-save($this-params['data']); $userID = $this-Answers-User-lastInsertId(); on the second line (line 29 in your script), you've called the model Answers, not answer. Try: if($this-Answer-User-save($this-params['data'])){ $userID = $this-Answer-User-id; }

Re: save data from ONE form to TWO models

2006-08-24 Thread Pablo Viojo
Check the object that /users/saveUser is returning, I think it's not only an id but a more complex structure.Regards,-- Pablo Viojo[EMAIL PROTECTED] http://pviojo.net On 8/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi, here is my problem: i need to get user_id before saving the answersof

Re: Re: save data from ONE form to TWO models

2006-08-24 Thread Samuel DeVore
Also if the models are related you can do if ($this-Answers-User-save(array('User'=$userData) { $user_id =$this-Answers-User-lastInsertId(); $this-params['data']['otherModelData']['userr_id'] = $user_id; // now do your save of other stuff not tested or what ever but gives you

Re: save data from ONE form to TWO models

2006-08-24 Thread [EMAIL PROTECTED]
i tried these codes: $this-Answer-User-save($this-params['data']); $userID = $this-Answers-User-lastInsertId(); but it said Fatal error: Call to a member function on a non-object in /home/felix/cake/sdq/controllers/answers_controller.php on line