Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/07/2013, 09:39
erickrpv
 
Fecha de Ingreso: abril-2013
Ubicación: Lima
Mensajes: 83
Antigüedad: 11 años, 1 mes
Puntos: 1
Respuesta: dos o mas consultas en 1

pon esto donde quieras buscar:
Cita:
<form action="buscar-fotos.php." method="post">
<h3> Búsqueda de fotos por Actividad <input type="text" name="buscarnom" height='20'/>

<input type="submit" value="Buscar" height ='20'/>
</form>
y esto donde quieras recibir resultados

Cita:
<?php
$query = "SELECT a.fotcod,a.fotsec,a.fottxt,a.fotimg,b.actcod,b.act nom FROM Tfoto a, Tacti b where a.fotcod = b.actcod";
if ($_POST['buscarnom'] <> ''){
$query = $query . " AND actnom like '%". $_POST['buscarnom'] ."%'";

}

$query = $query . " order by fotsec desc";

$result = mysql_query($query) or die(mysql_error());
while ($rows = mysql_fetch_array($result)){
echo "<table border = '0' bordercolor='#006CB8' height='40'><tr><div align='center'><img src=Actividades/" .$rows['fotcod'].$rows['fotsec']. ".jpg width='350' height='300'></div></tr><tr><td><div align=center><strong><font size='-2'>" . utf8_encode($rows['fottxt']) . "</div></td></tr></table>";
}
mysql_free_result($result);
mysql_close($conn);
?>