Help with PHP DB updates with html forms


#1

I am having some issues here. Everything else in my code works, but no matter what I try the database update does not work.

    public function start()
    {
        //Require login
        requireLogin();

        if (isset($_POST['deposit']))
        {
            $this->depositMoney();
        }
        elseif (isset($_POST['withdrawl']) )
        {
            $this->withdrawlMoney();
        }
        else
        {
            $this->tpl->display('bank.tpl');
        }
    }

    private function depositMoney()
    {
      $msg = '';
      if ($_POST['deposit_amount'] <= 0)
      {
          $msg = 'You cant deposit nothing or 0 gold!';
      }
      else {
          $depgive = $this->player->bmoney + $_POST['deposit_amount'];
          $deptake = $this->player->money - $_POST['deposit_amount'];
          $this->db->execute('UPDATE `<ezrpg>players` SET `money`=? `bmoney`=? WHERE `id`=?', array($deptake, $depgive, $this->player->id));
          $msg = 'You have deposited ' . $_POST['deposit_amount'] . ' gold!';
      }
        header('Location: index.php?mod=Bank&msg=' . urlencode($msg));
    }

Thats my “Module” I know its set-up right, for the most part. Now here is the page where it calls the function:

{include file="header.tpl" TITLE="Bank"}

<div class="row">
<div id="gamebody">
<div align=center><br />
  Welcome to the bank, you currently have <strong>{$player->bmoney}</strong>
  gold in the bank, would you like to withdrawl or deposit?
</div>
      <span class="space"></span>
{if $player->bmoney < 1}
<div class="left">
  <p>You don't have money to withdrawl!</p>
</div>
{else}
<div class="left">
<form method="post" action="index.php?mod=Bank">
  <label>Withdrawl</label>
  <input type="number" name="withdrawl_amount" autocomplete="off" min="0" max="{$player->bmoney}" />
  <input name="withdrawl" type="submit" value="Withdrawl" class="button" />
</form>
</div>
{/if}

<div class="right">
<form method="post" action="index.php?mod=Bank">
  <label>Deposit</label>
  <input type="number" name="deposit_amount" autocomplete="off" min="0" max="{$player->money}" />
  <input name="deposit" type="submit" value="Deposit" class="button" />
</form>
</div>
</div>
</div>

{include file="footer.tpl"}

For the life of me I can’t figure out where I am messing up. When I deposit 100 gold the “You have deposited 100 gold!” comes out correctly, however the database does not update, and I’m not sure why. (It does in other modules, and i’ve checked everything and as far as I can tell it SHOULD work.)

EDIT: I should clarify that I’m having issues with the deposit code. I know the withdraw is messed, want to figure out depost first.

EDIT 2: After wracking my brain for anouth hour or two, I figured out i was missing a very very important comma. Those dang pesky things.