<?php
$result = db_query('SELECT ref_karto, count(*) zenbat FROM {toponimo} GROUP BY ref_karto HAVING zenbat > 1');
while($row = db_fetch_object($result)){
$refs[] = $row->ref_karto;
}
$result = db_query('SELECT toponimo.*, node.* FROM {toponimo} LEFT JOIN node ON toponimo.nid = node.nid WHERE ref_karto IN ("'. join($refs, '","') .'")');
if($result){
$output = '<table>';
$output .= '<tr><th>Toponimoa</th><th>Erref. Kartografikoa</th><th></th></tr>';
while($row = db_fetch_object($result)){
$output .= '<tr><td>'. $row->title .'</td><td>'. $row->ref_karto .'</td><td>'. l('editatu', 'node/'.$row->nid) .'</td></tr>';
}
}
$output .= '</table>';
return $output;
?>