problem with synchronising data out of 2 queries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • justme@nospam.wanadoo.be

    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="javas cript">
    function call(location)
    {
    url = new String(parent.s ub.location.hre f);
    arrayOfStrings = url.split('#');
    parent.sub.loca tion = arrayOfStrings[0] + location;
    return false;
    }
    </script>
    </head>

    <body bgcolor="#77788 8">

    <?

    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="#77788 8" 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%">Dea ler</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</TD>
    <TD width="10%">Amo unt</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
  • steve

    #2
    Re: problem with synchronising data out of 2 queries

    "justme5" wrote:[color=blue]
    > Dears
    > I have created the following page to display my data
    >
    >
    > snip...
    >[/color]

    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

    Comment

    • justme@nospam.wanadoo.be

      #3
      Re: problem with synchronising data out of 2 queries

      On 22 Aug 2004 22:45:46 -0400, steve <UseLinkToEmail @dbForumz.com>
      wrote:
      [color=blue]
      >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.[/color]


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

      Paul

      Comment

      Working...