Thursday, July 1, 2010

Re: save() omitted

If you have id, you do not need to use create ()

2010/7/1 Andrei Mita <andrei.mita@gmail.com>
Hello,

I have tried many different ways to update a record in one table with no luck. In one simple function I have 2 save(update) queries. The first one is always skipped.

This is the one:

$game_final = array(
'id' => $this->Session->read('Game.game_id'),
'scored' => $scored,
'conceded' => $conceded,
'correct_answers' => $correct_answers,
'wrong_answers' => $wrong_answers,
'time_end' => date('Y-m-d H:i:s'),
'outcome' => $game_outcome);

$this->Game->create();
$this->Game->save($game_final);

Any help much appreciated.

Andrei

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



--
Edinei L. Cipriani
Blog: http://phpedinei.wordpress.com
Twitter: http://www.twitter.com/phpedinei

Desenvolvedor Colégio Trilingue Inovação
Site: http://www.colegioinovacao.com.br
Fone 49 84149086

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: