I was successful into displaying the data one after each other by using [or] in the while statement.
(Date)********(PayPal)********(CC)********(Total)
(2003-4-21)*****(50)**********(0)**********(50)
(2003-4-21)*****(0)**********(20)**********(70)
(2003-4-22)*****(50)**********(0)**********(120)
Also, I was successful into displaying the data that have same date (CC & PayPal) by using [and] in the while statement.
(Date)********(PayPal)********(CC)********(Total)
(2003-4-21)*****(50)**********(20)**********(70)
What I need, is to display all data unique and similar dates.
Example what I want:
(Date)********(PayPal)********(CC)********(Total)
(2003-4-21)*****(50)**********(20)**********(70)
(2003-4-22)*****(50)**********(0)**********(120)
please help
<table width="55%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#FFCC99">
<td><div align="center"><font color="#000000">Date</font></div></td>
<td><div align="center"><font color="#000000">PayPal</font></div></td>
<td><div align="center"><font color="#000000">CC</font></div></td>
<td><div align="center"><font color="#000000">Total</font></div></td>
</tr>
<?
$sql="select *from cc";
$result = $db->EXECUTE($sql);
$sqlx="select *from paypal";
$resul = $db->EXECUTE($sqlx);
$o = 0;
$w = 0;
while ($i = mysql_fetch_array($result) and $dd = mysql_fetch_array($resul)){
$o = $i[lu_withdraw];
$w = $dd[amount];
if ($i[lu_date] && $dd[date]){
$sdate = $i[lu_date];
}elseif ($i[lu_date] XOR $dd[date]){
$sdate = $i[lu_date].$dd[date];
}
$bax += $o + $w;
<tr bgcolor="#FFFFCC">
<td><div align="center"><? echo "<font color='#000000'>$sdate</font>";?></div></td>
<td><div align="center"><? echo"<font color='#990000'>$w</font>";?></div></td>
<td><div align="center"><? echo"<font color='#660099'>$o</font>";?></div></td>
<td><div align="center"><? echo"<font color='#FF0000'>$bax</font>";?></div></td>
</tr>
<?
}
?>
I can display the results of either CC or paypal table. However, I need to display the results of both tables at once and not one at a time.
the code above can do that with the exception of the date field.
example: on 2003-4-5 there was a transaction of $5 CC and on the same date, there was a transaction of $66 PayPal. I need to display the following:
(date)*******(PayPal)*******(CC)********(total)
(2003-4-5)*******(66)*******(5)*********(71)
how do I do that? how can I take results from two tables and display them at once keeping in mind that some results share same date and other results have different dates?
thank you
You may have to load them both into seperate arrays and then collate them. If you add an order by clause to both queries that should make it easier.
There seems to be no relationship between the two tables. That is what makes it difficult, there should be an easier way but I can't think of one at the moment.