$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;
}
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
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
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