I created this page see the complete script below
<head>
<style type="text/css">
body, td, th, h1, h2 {font-family: sans-serif;}
body, td, th {font-size: 100%;}
a:link { font-weight:bold; color:E00000; text-decoration:none }
a:visited { font-weight:bold; color:E00000; text-decoration:none }
a:hover { font-weight:bold; color:#E00000; text-decoration:none }
a:active { font-weight:bold; color:#F00000; text-decoration:none }
a:focus { font-weight:bold; color:#E00000; text-decoration:none }
.text1 {font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: White;text-align : left;}
</style>
<script language="javascript">
function call(location)
{
url = new String(parent.sub.location.href);
arrayOfStrings = url.split('#');
parent.sub.location = arrayOfStrings[0] + location;
return false;
}
</script>
</head>
<body bgcolor="#777888">
<?
include "datas/connection_data.php";
include "datas/connect.php";
include "datas/stats2.php";
$Dblnk=connect ();
if ($res=send_sql($Data_Base, $Query))
{
while ($row = mysql_fetch_row ($res))
{
$Line1 = $Line1.$row[0]." <BR>";
}
}
?>
<TABLE bgcolor="#777888" border="1" width="100%">
<TR>
<TD align="center" colspan="22" bgcolor="grey"><B><FONT size="+2">Rem amount POR</FONT></B></TD></TR>
<TR>
<TD align="center" colspan="1"><B>Dealer</B></TD>
<TD align="center" colspan="1"><B>Jan2004</B></TD>
<TD align="center" colspan="1"><B>Feb2004</B></TD>
<TD align="center" colspan="1"><B>Mar2004</B></TD>
<TD align="center" colspan="1"><B>Apr2004</B></TD>
<TD align="center" colspan="1"><B>MAY2004</B></TD>
<TD align="center" colspan="1"><B>JUN2004</B></TD>
<TD align="center" colspan="1"><B>JUL2004</B></TD>
<TD align="center" colspan="1"><B>AUG2004</B></TD>
<TD align="center" colspan="1"><B>Sep2004</B></TD>
<TD align="center" colspan="1"><B>OCT2004</B></TD>
<TD align="center" colspan="1"><B>NOV2004</B></TD>
<TD align="center" colspan="1"><B>Dec2004</B></TD>
<TD align="center" colspan="1"><B>Totaal</B></TD>
<TR align="center">
<TD width="10%">Dealer</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD>
<TD width="10%">Amount</TD></TD>
</TR>
<TR>
<TD width="10%"><? echo "$Line1" ?></TD></TR>
</TR>
</TABLE>
the query that I use to display at " <? echo "$line1" ?> is this one
<?
$Query = "SELECT DISTINCT DEALER_REM FROM ELEC_REM_NOTE WHERE CURRENT_MONTH like '%2004'group by Dealer_rem";
?>
One of the queries that I need is the following one
$jan = "SELECT DISTINCT DEALER_REM ,SUM(TOTAL_REM_AMOUNT) FROM ELEC_REM_NOTE WHERE CURRENT_MONTH ='JAN2004'AND BLOC_ID IN(1,2,3,4,5,7,8,10,12) group by Dealer_rem";
I have to use this query 12 times once for each month of the year.
the problem that I have is that the result of $jan has to be matched with the result of $Query and when the result is not equal it has to display "0" (=zero).
example a salesperson callled dave sold in January 5 items and in February nothing on the other hand his collegue (Stanley) sold 3 Items in January and 1 in February.
I already have all the salespersons in my table but I need to find a way to match the results from Dave with the ones from dave and so on.
salesperson January | February
dave| 5 | 0 |
Stanley| 3| 1|
and this for all the rest of the month
thanks for your coop and feedback
Paul