Jump to content

Recommended Posts

@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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.