<?php
function scan_titles($id, $startterm)
{
yaz_scan($id, "rpn", "@attr 1=4 " . $startterm);
yaz_wait();
$errno = yaz_errno($id);
if ($errno == 0) {
$ar = yaz_scan_result($id, $options);
echo 'Scan ok; ';
foreach ($options as $key => $val) {
echo "$key = $val ";
}
echo '<br /><table>';
while (list($key, list($k, $term, $tcount)) = each($ar)) {
if (empty($k)) continue;
echo "<tr><td>$term</td><td>$tcount</td></tr>";
}
echo '</table>';
} else {
echo "Scan failed. Error: " . yaz_error($id) . "<br />";
}
}
?>