title: CakePHP 2.8.4: Change User balance
body: <p>I wanna change the balance of an account in my table <em>Users</em>. But I want to do this in a another Controller instead of the UsersController.</p>
  
  <p>M Code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> public function myfunctionname() {
      $this-&gt;layout = 'customer';
      $this-&gt;loadModel('User');
  
      if ($this-&gt;request-&gt;is('post')) {
        // Some working stuff
      $this-&gt;User-&gt;updateAll(array('balance' =&gt; 'balance - 5'), array('customerid' =&gt; $this-&gt;Session-&gt;read('Auth.User.id')));
          $this-&gt;MyControllerName-&gt;create();
          if ($this-&gt;MyControllerName-&gt;save($this-&gt;request-&gt;data)) {
            $this-&gt;Flash-&gt;success( __('Success!'));
            $this-&gt;redirect('some redirect');
          } else {
            $this-&gt;Flash-&gt;error( __('Error!'));
          }
      }
   }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I will get the following error:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Database Error
  
  Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customerid' in 'where clause'
  
  SQL Query: UPDATE `mydbname`.`users` AS `User` SET `User`.`balance` = balance - 5 WHERE `customerid` = '5' </code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you!</p>