PHP interesse |
|
dat ik met een group by moet werken had ik al verwacht maar hoe precies.. ? iemand ?
<?
$res = mysql_query("SELECT * FROM referers ORDER BY unique_hits DESC");
while ($obj = mysql_fetch_object($res)) {
?>
<tr>
<td width="100" align="left"><a href="<? echo "http://www.".$obj->ref."";?>" target="_blank"><i><? echo $obj->site_naam; ?></i></a></td>
<td align="center"><? echo $obj->unique_hits+1; ?></td>
<td align="center"><? echo $obj->inhits; ?></td>
<td align="left"><a href="mailto:<?=$obj->mail;?>"><? echo $obj->mail; ?></a></td>
</tr>
<?
}
?>
<? $res = mysql_query("SELECT * FROM referers ORDER BY unique_hits DESC"); ?> <tr> <td width="100" align="left"><a href=" <? echo "http://www.".$obj->ref."";? >" target="_blank"><i> <? echo $obj->site_naam; ?></i></a></td> <td align="center"> <? echo $obj->unique_hits+1; ?></td> <td align="center"> <? echo $obj->inhits; ?></td> <td align="left"><a href="mailto: <?=$obj->mail;? >"> <? echo $obj->mail; ?></a></td> </tr> <? } ?>
dit heb ik nu
$res = mysql_query("SELECT site_naam,SUM(inhits) as inhits,SUM(unique_hits+1) as unique_hits,ref,mail FROM referers GROUP BY site_naam ORDER by unique_hits DESC");
$res = mysql_query("SELECT site_naam,SUM(inhits) as inhits,SUM(unique_hits+1) as unique_hits,ref,mail FROM referers GROUP BY site_naam ORDER by unique_hits DESC");
met dit is het gelukt bedankt |