$result = mysql_query("select linkurl from combust where link = '1'");while($row = mysql_fetch_assoc($result)) {preg_match("/^(http:\/\/)?([^\/]+)/i", $row[linkurl], $matches);$host = $matches[2];preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);// $resultz = mysql_query("select linkurl,clicks from combust where linkurl like '%$matches[0]%' order by clicks desc");$resultz = mysql_query("select distinct sum(clicks) as totalclicks from combust where linkurl like '%$matches[0]%'");while($rowz = mysql_fetch_assoc($resultz)) {echo '<tr><td align="left" valign="top">'.$matches[0].'</td><td width="70"><b>Hits: '.$rowz[totalclicks].'</b></td></tr>';}}