Same Data Appear only once.

Posted by friendishan on Stack Overflow See other posts from Stack Overflow or by friendishan
Published on 2010-12-22T06:49:39Z Indexed on 2010/12/22 6:54 UTC
Read the original article Hit count: 139

Filed under:
|
|
|
|

I have the following code which produces following output:-

<?
$tablaes = mysql_query("SELECT * FROM members where id='$order[user_id]'"); 
$user = mysql_fetch_array($tablaes);
$idsd=$user['id'];
$rPaid=mysql_query("SELECT SUM(`price`) AS total FROM order_history WHERE type!='rent_referral' AND date>'" . strtotime($time1) . "' AND date<'" . strtotime($time2) . "'");
$hdPaid = mysql_fetch_array($rPaid);
$sPaid=mysql_query("SELECT SUM(`price`) AS total FROM order_history WHERE user_id='$idsd' AND type!='rent_referral' AND date>'" . strtotime($time1) . "' AND date<'" . strtotime($time2) . "'");
while ($hPaid = mysql_fetch_array($sPaid)) { 
?>

<td><?=$user['username']?></td>
<td><?=$hPaid['total']?></td>
<?  
}
?>

</tr>

It appears like this http://dl.dropbox.com/u/14384295/darrenan.jpg

I want same data to appear only once..

Like Username: Vegas and price with him only once.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql