Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

problem with next page and queries
Dears
I have created the following page to display my data

<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, $Year))

{
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 Queries that I want to use in this page are the following 2
Queries

the first one is to display the data mentioned  here <? echo "$Line1"
?> and contains the following Query
$Year = "SELECT DISTINCT DEALER_REM FROM ELEC_REM_NOTE WHERE
CURRENT_MONTH like '%2004'group by Dealer_rem";

the second type of query I want to use is this one

$Query = "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";


the problem that I have is that the result that I get from Query 2 has
to match the result of Query 1

example :

the table that I have as mentioned above is

Dealer January February March April ect.

I have 2 salesman working for me in January ED and Bert, Ed Sold 3
computers and Bert 5.
IN February I hire another salesman to keep up with the workload his
name is Charley
Ed Sells in February 4 Computers Bert 6 and Charley 5
In March Ed Is leaving the company and I hire a new guy named Pete to
replace Ed.
Bert sells 7 Computers Charley 6 and Pete 3



when I run the first Query the result will be Bert, Charley, Ed, and
Pete.

the result of the second Query has to be displayed in the following
way:

Dealer January February March
Bert         5             6             7
Charley   0             5             6
Ed           3             4             0
Pete        0             0             3


How can I manipulate the result of the second Query that it's matching
the Result of the First Query? And how can I insert a 0 for each time
the 2nd query didn't find a result for the given name mentioned in the
first query?

thanks for the help and feedback

Paul

Report this thread to moderator Post Follow-up to this message
Old Post
justme@nospam.wanadoo.be
08-23-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.