Try this:
PHP Code:
$get_info = mysql_query("
select A.catid
, count(AR.id) as tot
from categories A
left outer
join links AR
on A.catid = AR.catid
where A.visible='1'
AND AR.visible='1'
group
by A.catid
") or die("Unable to complete query: '".mysql_error()." ");
if(mysql_num_rows($get_info)) {
while ($info= mysql_fetch_array($get_info)) {
echo '<br> '.$info[catid] .' has '.$info[tot].' links! ';
}
} else {
echo "No records found!";
}