problem with synchronising data out of 2 queries

This is a discussion on problem with synchronising data out of 2 queries within the PHP Language forums, part of the PHP Programming Forums category; Dears I have created the following page to display my data <head> <style type="text/css&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-22-2004
justme@nospam.wanadoo.be
 
Posts: n/a
Default problem with synchronising data out of 2 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
Reply With Quote
  #2 (permalink)  
Old 08-23-2004
steve
 
Posts: n/a
Default Re: problem with synchronising data out of 2 queries

"justme5" wrote:
> Dears
> I have created the following page to display my data
>
>
> snip...
>


May I suggest a much-shortened post next time. I for one, would
rather look at posts that are very concise, before answering. At the
same time, hope someone reads it thru and answers your post.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-problem-...ict142132.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=475433
Reply With Quote
  #3 (permalink)  
Old 08-23-2004
justme@nospam.wanadoo.be
 
Posts: n/a
Default Re: problem with synchronising data out of 2 queries

On 22 Aug 2004 22:45:46 -0400, steve <UseLinkToEmail@dbForumz.com>
wrote:

>May I suggest a much-shortened post next time. I for one, would
>rather look at posts that are very concise, before answering. At the
>same time, hope someone reads it thru and answers your post.



Steve I agree with you but I just wanted to be precise In my
explanation
any help is still very much apreciated

Paul
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:01 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0