I have a field called force. Its by default a null field. I want to add 1 everytime I run an if block. here is my code sample
if($somecondition){
$array = array();
$array[] = $this->Model->read(null, 1);
$array['force']++;
$this->Model->updateAll(array('Model.complete' => 1, 'Model.force' => $array['force']),array('Model.completed IS NULL'));
}
I am getting an error of undefined variable $array. Not sure why.
it seems you are very new to Cake (and maybe even PHP)
It you can, change the default value of ‘force’ to 0 in the DB, so you don’t have to check for that here.