i work with php/Mysql
i have table with two cols (date , cash) with values like {7/2001:100$, 12/2001:50$ , 1/2002:30$ , 5/2002:90$ , 6/2003:80$,9/2003:20$ } i would like to make cash flow table that have cols (Jan,Feb,Mar,............Dec) and row for every year in the date array and the value of cash in the table cells like blow .
How to display this array {7/2001:100$, 12/2001:50$ , 1/2002:30$ , 5/2002:90$ , 6/2003:80$,9/2003:20$ } as blow ??????
|Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2001 | 0 | 0 | 0 | 0 | 0 | 0 | 100$ | 0 | 0 | 0 | 0 | 50$ |
--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2002 | 30$ | 0 | 0 | 0 | 90$ | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
--------+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2003 | 0 | 0 | 0 | 0 | 0 | 80$ | 0 | 0 | 20$ | 0 | 0 | 0 |
ok this the code that retrive rows from database and draw it in a table (date ,cash) like the format of the array
mysql_connect("localhost","","");
mysql_select_db("");
$var3=$_REQUEST['order_num'];
$cashtotal=0;
$summat = mysql_query("SELECT * FROM cash_flow WHERE order_num='$var3'");
while ($row = mysql_fetch_assoc($summat)) {
print "<tr>";
print "<td>$row[cash_date]</td>";
print "<td>$row[cash]</td>";
print "</tr>";
}