Jump to content

PHP PAYMENT SUBTRACTION


timber16

Recommended Posts

im having a problem regarding on how to subtract the amount and the current balance of a creditcard dummy . i really need it on my project. please help me.

 

<?php
/* 
        ELOAD_VIEW.PHP
        Displays all data from 'players' table
*/

        // connect to the database
        include('connect-db.php');

        // get results from database
        $result = mysql_query("SELECT * FROM eload") 
                or die(mysql_error());  
                
        // display data in table
        echo "<p><b>View All</b> | <a href=eload_list_view.php?page=1'>View Paginated</a></p>";
                echo "<table border='1' cellpadding='5'>";
                echo "<tr> <th>ID</th> <th>Gamecard Purchase</th> <th>Amount</th> <th>Quantity</th>
                <th>Transaction</th> <th></th> <th></th></tr>";
                 // loop through results of database query, displaying them in the table
                while($row = mysql_fetch_array( $result )) {
                echo "<tr>";
                echo '<td>' . $row['id'] . '</td>';
                echo '<td>' . $row['gamecard'] . '</td>';
                echo '<td>' . $row['amount'] . '</td>';
                echo '<td>' . $row['quantity'] . '</td>';
                echo '<td>' . $row['transaction'] . '</td>';
                echo '<td><a href="eload_edit.php?id=' . $row['id'] . '">Change</a></td>';
                echo '<td><a href="eload_delete.php?id=' . $row['id'] . '">Delete Transaction</a></td>';
                echo "</tr>";
                
        }
        $result = mysql_query("SELECT * FROM eload") 
                or die(mysql_error());  
                
        echo "<table border='1' cellpadding='10'>";
        echo "<tr> <th>ID</th> <th>amount</th> <th>Balance</th> <th>Quantity</th> <th>Current Balance</th></tr>";

        // loop through results of database query, displaying them in the table
        while($row = mysql_fetch_array( $result )) { 
                
                echo "<tr>";
                echo '<td>' . $row['id'] . '</td>';
                echo '<td>' . $row['amount'] . '</td>';
                echo '<td>' . $row['balance'] . '</td>';
                echo '<td>' . $row['sum_total = $quantity * $amount - $balance'] . '</td>';
                echo "</tr>";
                
                echo ($sum_total);
        } 

        // close table>
        echo "</table>";
        echo "<p><a href='eload.php?page=1'>Another Transaction?Click Here</a></p>";
?>

 

:( :( :( :( :( :( :(

post-131839-13482403265815_thumb.jpg

Link to comment
https://forums.phpfreaks.com/topic/257470-php-payment-subtraction/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.