Good evening
Please i have a question i would like to ask here. I am trying to write a program that when i click transfers, it would deduct the amount from the balance and update with the new balance in the mysql database.
My code looks like this
Edit:
$myotp = $_POST['otp'];
if(OTPPASS==$myotp)
{
    $amt = $POST['amt'];
    require 'config/config.php';
    $con = mysqli_connect($hostname, $user, $pass, $db) or die ('Cannot connect');
    $sql = "select openBal from accInfo where userID ='".$_SESSION['userID']."'";
    $result = mysqli_query($con,$sql);
    $row = mysqli_fetch_array($result);
    $balance = $row['openBal'];
    $account = $row['accountNo'];
    $sql2 = "update accInfo set openBal='".$balance."'-$amt here accountNo='".$account."'";
    mysqli_query($con,$sql2);
    echo "Transfer Complete";
    mysqli_close($con);
    header('Location: success.html');
}else{
        echo ("<SCRIPT LANGUAGE='JavaScript'>
    window.alert('Transaction Failed')
    window.location.href='transfers.php';
    </SCRIPT>");    
}
?>
Question is it doesnt deduct the balance from the database row , $row['openBal'] I need Further explaniation on this , sought the internet and couldnt find a good article.
I started thinking maybe its the way i setup the sql File..
