Skip to main content

Gaurko bera eta EK desberdina duten sarrerak bilatu

<?php
$output = '<p></p>';

// $result = db_query('SELECT n.title, t1.nid, t1.ref_karto FROM toponimo t1 LEFT JOIN node n ON t1.nid = n.nid LEFT JOIN toponimo t2 ON t1.gako = t2.gako WHERE t1.ref_karto != t2.ref_karto AND t1.gako != "?" GROUP BY t1.nid ORDER BY t1.gako');

// arinagoa
$result = db_query('SELECT n.title, t1.nid, t1.ref_karto FROM toponimo t1, toponimo t2 LEFT JOIN node n ON t1.nid = n.nid WHERE t1.gako = t2.gako AND t1.ref_karto != t2.ref_karto AND t1.gako != "?" GROUP BY t1.nid ORDER BY t1.gako');

if($result){

while($row = db_fetch_object($result)){
$row->nid = l(('edit'), 'node/'.$row->nid.'/edit', array('target' => '_blank'));
$rows[$row->title][] = array($row->nid, $row->ref_karto);
}
foreach($rows as $k => $v){
$headers = array('', $k);
$output .= theme('table', $headers, $rows[$k]);
}

} else {
$output .= '<p>Ez dago baldintza horiek betetzen dituen sarrerarik.</p>';
}

return $output;
?>