Jump to content

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

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.