carlito.way00 Posted July 1, 2011 Share Posted July 1, 2011 @masters Guess this was were I was suppose to put my request or my issues, I am sorry if I have posted it in the regular php coding forum, but as I inquire to be a php freak as my masters so forgive one again if I have commited a crime in posting my query here <?php if(isset($_POST['bpayment'])) { $reciversname = $_POST['reciversname']; $amounttransact = $_POST['amounttransact']; $anumber = $_POST['anumber']; $bymemo = $_POST['bymemo']; if($reciversname == NULL OR $amounttransact == NULL OR $anumber == NULL ) { $final_report .= "Your Payment was not initiated."; } else { $check_receiveraccct = mysql_query("SELECT * FROM members WHERE anumber = '".$_POST[ 'anumber']."'") or die(mysql_error()); while ($row = mysql_fetch_assoc($check_receiveraccct)) { $amounttransact = $row['amounttransact']; $anumber = $row['anumber']; $acctbal = $row['acctbal']; $statementdate = $row['$statementdate']; $transctype = $row['transctype']; } if(mysql_num_rows($check_receiveraccct) != 0) { $statementdate = date('Y-m-d'); $charges = '0.00'; $transctype = 'Bill Payment'; $acctbal = $intacctbal + $amounttransact; $result_receiver = mysql_query("UPDATE members SET acctbal = '$acctbal' + '$_POST[amounttransact]' , amounttransact = '$_POST[amounttransact]' , statementdate = '$statementdate' , transctype = '$transctype', charges = '$charges' WHERE anumber = '$_POST[anumber]'") or die(mysql_error()); $check_senderaccct = mysql_query("SELECT * FROM members WHERE username = '". $_SESSION['username']."'") or die(mysql_error()); while ($row = mysql_fetch_array($check_senderaccct)) { $amounttransact = $row['amounttransact']; $anumber = $row['anumber']; $acctbal = $row['acctbal']; $statementdate = $row['statementdate']; $statementtrasct = $row['statementtrasct']; $charges = $row['charges']; } if ($_POST['amounttransact'] >= $acctbal) { $final_report .= "Insufficient Funds."; } else { $statementdate = date('Y-m-d'); $transctype = 'Bill Payment'; $charges = '0.50'; $acctbal = $acctbal - ($amounttransact + $charges); $result_sender = mysql_query("UPDATE members SET acctbal = '$acctbal' - ('$_POST[amounttransact]' + '$charges') , amounttransact = '$_POST[amounttransact]', statementdate = '$statementdate', transctype = '$transctype' , charges = '$charges' WHERE username = '$_SESSION[username]'") or die(mysql_error()); $final_report .= "Your Transfer has been successful."; } } else { $final_report .= "Receivers Account is invalid."; } } } ?> errors : When I transfer funds from one act to another , it goes but it wipes out the balance of the senders acct and only credits the receiver with the transacted amount I will be glad if anyone could help me with my math problem here Quote Link to comment https://forums.phpfreaks.com/topic/240906-having-money-problems-with-my-transfer-form/ Share on other sites More sharing options...
xyph Posted July 4, 2011 Share Posted July 4, 2011 This is more a PHP issue than a math issue. Try echo'ing out your queries. You'll probably find your issue there. Quote Link to comment https://forums.phpfreaks.com/topic/240906-having-money-problems-with-my-transfer-form/#findComment-1238296 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.