shaneHoll Posted November 10, 2013 Share Posted November 10, 2013 anyone help with the below code which isnt changing the balance field <html> <body> <?php $mysqli = new mysqli("localhost","cl49-XXX","XXX"); $accountfrom=$_POST[accountfrom]; $accountto=$_POST[accountto]; $amount=$_POST[amount]; $result = $mysqli->query("SELECT * FROM member WHERE personID=$accountfrom"); $row = mysqli_fetch_array($result); $businesstype = $row['businesstype'] ; $select_result = $mysqli->query("SELECT * FROM member where personID='$accountfrom' "); $select = mysqli_fetch_array($select_result); $balance=$select['balance']; echo" Amount $amount"; if($balance>=$amount){ $result2 = $mysqli->query("UPDATE member SET balance = IF(personID = $accountfrom, balance-$amount, balance+$amount) WHERE personID IN ($accountfrom, $accountto)"); } else { echo" Not enough funds to do that"; } ?> <h3>Transfer Complete</h3><br /> <table border='0'> <tr> <td><b><font color='black' weight='bold'>Date</b> </td> <td><b><font color='black'>Account From</b> </td> <td><b><font color='black'>Account To</b> </td> <td><b><font color='black'>Amount</b></td> <td><b><font color='black'>Balance</b></td> </tr> <?php $row2 = mysqli_fetch_array($result); $balance2 = $row2 ['balance']; echo" <td><font color='green'>09/11/2013</td> <td><font color='green'>$businesstype </b></td> <td><font color='green'>$businesstype1 </b> </td> <td><font color='green'>£$amount </td> <td><font color='green'>£$balance2</td> </tr> </table> "; ?> </body> <html > Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.