Tuesday, March 1, 2011

Help with update

Hello,

I'm trying to perform an update to my model in order to reflect a
change in the inventory value. The values that I'm passing to $id,
and $quantity below are correct, but even with a hard coded value of 5
the database still gets updated with a 0 for the inventory field for
the given id. This leads me to think I'm not passing the information
correctly to $this->save as I was using an update example from the 1.3
book for Saving Data.

In Model:

function updateInventory($id, $quantity) {

$this->id = $id;
$this->inventory = '5';
if($this->save($this->data, array('validate' => 'false',
'fieldList' => array('id', 'inventory')))) {
.....

}

Thanks,
Brian

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: