Bom, encontrei a resposta e estou colocando aqui para que quizer usar, funciona blz.
Não fui eu quem fiz, peguei em um site.
<html>
<head>
<title>Pesquisa Interna</title>
</head>
<?
# funcao para conectar no Banco de dados
function db_connect() {
$link = mysql_connect("localhost", "root", "");
if ($link && mysql_select_db("bancodados", $link)) {
return($link);
}
return(FALSE);
}
?>
<body bgcolor="#FFFFFF" text="#000000">
<p><font size="4"><b>Pesquisa Interna</b></font></p>
<?
if(strlen($OK) > 0) {
echo("<P><b>Resultado da Pesquisa Interna</b><p>");
$varSQL = "SELECT * FROM Search WHERE Body LIKE '%";
#abrindo conexao
$conn = db_connect() or die("Não foi possível conectar!");
$pares = split(" ", $chave);
for($i=0; $i<count($pares); $i++) {
$varSQL = $varSQL.$pares[$i]."%' ";
if ($i!=(count($pares)-1)) {
$varSQL = $varSQL."AND Body LIKE '%";
}
}
$resultado = mysql_query($varSQL) or die ("<p>Erro ao fazer a pesquisa. Tente novamente!");
$contador = 0;
while ($linha=mysql_fetch_array($resultado)) {
++$contador;
if ($contador >= $start && $contador < ($start + $max)) {
$NomePagina = $linha["NomePagina"];
$Titulo = $linha["Titulo"];
$Body = $linha["Body"];
echo("<p>");
echo("<b><a href=/kwb/$NomePagina>$Titulo</a></b><br>");
echo(substr($Body, 0, 400)." ...<br>");
echo("<font color=\"Gray\">$NomePagina</font>");
}
}
echo("<p>");
echo("<table width=150 cellspacing=0 cellpadding=0><tr><td>");
if ($start != '1') {
echo("<form method=post action=pesquise.php>");
echo("<input type=Hidden name=chave value=$chave>");
echo("<input type=Hidden name=start value=".($start - $max)."><input type=Hidden name=max value=$max>");
echo("<input type=submit name=OK value=Anterior>");
echo("</form>");
}
echo("</td><td>");
if ($contador > ($start + $max)) {
echo("<form method=post action=pesquise.php>");
echo("<input type=Hidden name=chave value=$chave>");
echo("<input type=Hidden name=start value=".($start + $max)."><input type=Hidden name=max value=$max>");
echo("<input type=submit name=OK value=Proximo>");
echo("</form>");
}
echo("</td></tr></table>");
#fechando a conexao
mysql_close($conn);
} else {
?>
<form name="form1" method="post" action="pesquise.php">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Pesquise por:</td>
<td>
<input type="text" name="chave" size="20" maxlength="255">
</td>
<td>
<input type="submit" name="OK" value="OK">
</td>
</tr>
</table>
<input type="Hidden" name="start" value="1">
<input type="Hidden" name="max" value="10">
</form>
<?
}
?>
</body>
</html>Só coloquei aqui pq derrepente alguem pode estar querendo um cod do mesmo tipo.
Obrigado a todos que ajudaram e t+



Postagens
Não informado
