Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/01/2010, 11:44
serbc27
 
Fecha de Ingreso: febrero-2007
Mensajes: 165
Antigüedad: 17 años, 2 meses
Puntos: 0
Respuesta: busqueda php mysql

Espero que te sirva

$link = mysql_connect($hostname_BD,$username_BD,$password_ BD);
mysql_select_db($database_BD,$link);
$querynot = "SELECT * from noticias WHERE noticia LIKE '%{$_POST['palabra']}%' or resumennoticia LIKE '%{$_POST['palabra']}%' OR titulo LIKE '%{$_POST['palabra']}%' ORDER BY fecha desc";
$resultnot = mysql_query($querynot,$link);
$foundnot = false;
$totalRowsnot = mysql_num_rows($resultnot);
echo "<span class='texto1'><b> Noticias (" . $totalRowsnot . ")</span></b>";
while ($rownot = mysql_fetch_array($resultnot)) {
$foundnot = true;
echo "<p class='texto1'>";
echo "<a class='texto1' href='vernoticia.php?idnoticia=" . $rownot['idnoticia'] . " ' " . ">" . date("d-m-Y",strtotime($rownot['fecha'])) . " - " . $rownot['titulo']. "</a><br />";
echo "</p>";
}
if(!$foundnot) {
echo "<p class='texto1'><i class='texto1'>No se encontr&oacute; la palabra introducida</i></p>";
}