Ik heb een volgende pagina opgebouwd met de volgende gegevens daarin
[php]
<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>
[/php]
en ik gebruik de volgende query die bij <? echo "$line1" ?> wordt gebruikt
[php]
<?
$Query = "SELECT DISTINCT DEALER_REM FROM ELEC_REM_NOTE WHERE CURRENT_MONTH like '%2004'group by Dealer_rem";
?>
de query die ik in ieder geval nodig heb om de resultaten weer te geven is de volgende :
$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";
dit geeft me het gewenste resultaat wat ik nodig heb. deze query moet ik dus 12 keer hebben voor iedere maand van het jaar 1
ik zit vast want ik weet niet hoe ik nu de juiste query moet aanroepen om de juiste gegevens in de juiste kolom te krijgen en die ook nog overeenstemt met het resultaat van die maand
bijv :
jan die verkoopt in Januari 0 maar in Feb 3 stuks.
dus ik zou Jan op de eerste rij hebben met in de kolom january2004 als resultaat 0 en in de kolom van february 3
op de tweede rij piet die in jan 5 stuks verkocht heeft en in february 3
enz
alvast bedankt voor de moeite en feedback
Paul
750 views