I have the following code that is working but i need further functionality.
The code shows the payments made and is based on two tables. The payments table that has the following fields mID, type (account type), dayentered(date when the money was donated) and the members table has the following fields name, mID (this is the primary key) and status
Now my proble is that i can not add the following functionality to the code
1. Total for each type of payment account (the payments are based on different types eg for utilities, for building and these are recurrent for each month)
2. Total for all the accounts for each year
3. A code so that the name of the person should be shown on the page (The members page has the following fields name, mID (this is the primary key), status.
please help
Here is the code
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>details</title>
<h1>Details of your payments</h1>
</head>
<body>
<?php
//require_once('auth.php');
/*
*/
// connect to the database
include('connect.php');
$mID = $_GET['mID'];
$result = mysql_query("SELECT DISTINCT mID, sum(amount), type, dayentered
FROM payments
WHERE mID=$mID
GROUP BY TYPE, YEAR(dayentered), MONTH(dayentered)
")
or die(mysql_error());
// display data in table
echo "<p><b>View All</b> </a></p>";
echo "<table border='1' cellpadding='10'>";
echo "<tr> <th>SERIAL</th> <th>ACC TYPE</th> <th>MONTH PAID</th> <th>AMOUNT</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['mID'] . '</td>';
echo '<td>' . $row['type'] . '</td>';
echo '<td>' . $row['dayentered'] . '</td>';
echo '<td>' . $row['sum(amount)'] . '</td>';
}
// close table>
echo "</table>";
?>
<p><a href="home.php">Home</a></p>
</body>
</html>