| Current Path : /var/www/html/mmishra/indem/iiita/ |
| Current File : /var/www/html/mmishra/indem/iiita/search.php |
You can also perform boolean searches:<br>
<b>+property -allotment</b> searches for pages containing the word <b>property</b> but not <b>allotment</b>.<br>
<br>
<? if ($q != "") {
echo "<br><i>Search results for <u>$q</u></i> ";
$lq = strtolower($q);
if (!$pg) $pg = 1;
$lstart = ($pg-1) * 10;
// len 3 words searched by conventional method
if (strlen($q) == 3)
$r = mysql_query("select SQL_CALC_FOUND_ROWS * from webpages where lower(keywords) like '%$lq%' or lower(content) like '%$lq%' or lower(title) like '%$lq%' LIMIT $lstart, 10");
else
$r = mysql_query("select SQL_CALC_FOUND_ROWS * from webpages where match(keywords, title, content) against ('$lq' in boolean mode) LIMIT $lstart, 10");
$tro = mysql_fetch_object(mysql_query("select FOUND_ROWS() as t"));
$total = $tro->t;
echo "<b>";
if (!$total) echo "No result found.";
else if ($total == 1) echo "1 page found.";
else echo "$total pages found.";
echo "</b><hr><ul>";
while($so = mysql_fetch_object($r)) {
if ($so->content_type == 'Static') {
$link = "inner.php?conf=$so->id";
$x1=mysql_fetch_object(mysql_query("select parent_id from sublinks where href='inner.php?conf=$so->id'"));
$x2=mysql_fetch_object(mysql_query("select * from mainlinks where link_id='$x1->parent_id'"));
echo "<li>";
if (trim($x2->linktitle) != "") echo "$x2->linktitle <img src='images/arrow.gif'> ";
echo "$so->title</b> <a href='$link&hilite=$q'>$link</a></li>";
}
}
echo "</ul><hr>";
if ($total > 10) {
echo "<div class=notice>Goto Page: [ ";
for($i=1; $i<=ceil($total/10); $i++) {
if ($i == $pg) echo "<b>$i</b>";
else echo "<a href='inner.php?conf=search&q=$q&pg=$i'>$i</a> ";
}
echo "]</div>";
}
}
?>