I'm creating an online mobile reloading site for a school project. But it seems my update statement is not working... but i think it was written correctly, so I cannot figure out what's wrong in my code. 

What my code does.. is when the user tries to reload his account, the balance column in the balance\_table must be updated.

Here is my code:
reloadaccount.php

```
<?php
if(!isset($_POST['send']))
{
    $usernumber = "09392316162";
    mysql_connect("localhost", "root", "");
    mysql_select_db("eloadretailer_db");
    $query0 = "SELECT * FROM `balance_table` WHERE `user_number` = $usernumber";
    $result = mysql_query($query0);
    echo"<form method='post' action='".$_SERVER['PHP_SELF']."'>";
    while($row = mysql_fetch_array($result))
    {
        $balance = $row['balance'];
    }
    echo"<input type='hidden' name='balance' value='".$row['balance']."' />";
    echo"<p>&nbsp;</p>";
    echo"<p>";
    echo"<label for='creditcardtype'>Credit Card Type: </label>";
    echo"<select name='creditcardtype' id='creditcardtype'>";
    echo"<option selected='selected'>Choose Credit Card</option>";
    echo"<option>Master Card</option>";
    echo"<option>Visa</option>";
    echo"</select>&nbsp;&nbsp;<img src='pics/creditcard.jpg' >";
    echo"</p>";
    echo"<p>";
    echo"<label for='creditcardnumber'>Credit Card Number: </label>";
    echo"<input type='text' name='creditcardnumber' id='creditcardnumber' />";
    echo"</p>";
    echo"<p>Expiration Date: &nbsp;&nbsp;";
    echo"<label for='month'>Month: </label>&nbsp;";
    echo"<select name='month' id='month'>";
    echo"<option selected='selected'>Month</option>";
    echo"<option>January</option>";
    echo"<option>February</option>";
    echo"<option>March</option>";
    echo"<option>April</option>";
    echo"<option>May</option>";
    echo"</select>";
    echo"<label for='year'>Year: </label>&nbsp;";
    echo"<select name='year' id='year'>";
    echo"<option selected='selected'>Year</option>";
    echo"<option>2020</option>";
    echo"<option>2019</option>";
    echo"<option>2018</option>";
    echo"<option>2017</option>";
    echo"<option>2016</option>";
    echo"<option>2015</option>";
    echo"<option>2014</option>";
    echo"<option>2013</option>";
    echo"</select>";
    echo"</p>";
    echo"<p>";
    echo"<label for='billingaddress'>Billing Address: </label>";
    echo"<textarea name='billingaddress' cols='40' id='billingaddress'>Billing Name, Street Address, City</textarea>";
    echo"</p>";
    echo"<p>";
    echo"<label for='zipcode'>Zip Code: </label>";
    echo"<input type='text' name='zipcode' id='zipcode' />";
    echo"</p>";
    echo"<p>";
    echo"<label>Amount to Load:";
    echo"<select name='amount' id='amount'>";
    echo"<option>Amount</option>";
    echo"<option value='100'>100</option>";
    echo"<option value='500'>500</option>";
    echo"<option value='1000'>1000</option>";
    echo"<option value='2000'>2000</option>";
    echo"<option value='3000'>3000</option>";
    echo"<option value='5000'>5000</option>";
    echo"</select>";
    echo"</label>";
    echo"</p>";
    echo"<p>&nbsp;</p>";
    echo"<p>";
    echo"<input type='submit' name='send' id='sendtransaction' value='Send Transaction' />";
    echo"</p>";
    echo"</form>";
}
else
{
    $connection = mysql_pconnect("localhost", "root", "") or die(mysql_error());
    mysql_select_db("eloadretailer_db") or die(mysql_error());

    $usernumber = "09392316162"; // its data type is varchar because if its int, 0 cannot be place before number 9

    $balance = mysql_real_escape_string($_POST['balance']);

    $amount = mysql_real_escape_string( $_POST['amount']);
    $totalbalance =  $balance+$amount;
    echo"balance = $totalbalance"; // $totalbalance is working...

    //the data type of balance is int 
        //and user_number is varchar                        
    $query = "UPDATE `balance_table` SET `balance`= $totalbalance WHERE `user_number` = $usernumber"; // this code is not working.. i dont know why...

    mysql_query($query)or mysql_error();
}
?>

```