timber16 Posted February 21, 2012 Share Posted February 21, 2012 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>"; ?> :( :( :( Quote Link to comment https://forums.phpfreaks.com/topic/257470-php-payment-subtraction/ 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.