Este es mi código
Código PHP:
<?php
$button = $_GET ['submit'];
$search = $_GET ['search'];
if (!$button)
echo"Ingrese el texto a buscar";
else{
if (strlen($search)<=3)
echo"El texto es demasiado corto";
else{
echo "Ha buscado<b>$search</b><hr size='1' color='blue'>";
mysql_connect("localhost","pyminsta_usearch","circuito17");
mysql_select_db("pyminsta_search");
$search_exploded = explode(" ", $search);
foreach($search_exploded as $search_each){
$x++
if ($x==1)
$construct .= "Keywords LIKE '%$search_each%'";
else
$construct .= "Keywords LIKE '%%$search_each'";
}
$construct = "SELECT * FROM searchengine $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if ($foundnum==0)
echo "No hay resultado de la busqueda";
else
{
echo "$foundnum results found.<p>";
while ($runrows = mysql_fetch_assoc($run))
{
$title = $runrows['title'];
$desc = $runrows['description'];
$url = $runrows['url'];
echo "
<br />
<b><a href='$url'>$title</a></b><p>
$desc<br />__________________________";
}
}
}
}
?>