Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/11/2009, 19:41
Avatar de revapax
revapax
 
Fecha de Ingreso: octubre-2008
Ubicación: Santiago
Mensajes: 39
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: Busqueda multiple

gracias, lo he implementado asi....

Código:
<?php
$link = mysql_connect ("localhost", "root", "");
mysql_select_db("veterinaria");

$sql = "SELECT * FROM mascota where";
if($_GET["rut"] != '')$sql .= " AND CLIENTE_IdCliente = '".$_GET["rut"]."'";
if($_GET["raza"] != '')$sql .= " AND RAZA_NombreRaza = '".$_GET["raza"]."'";
if($_GET["especie"] != '')$sql .= " AND EspecieMascota = '".$_GET["especie"]."'";
if($_GET["nombre"] != '')$sql .= " AND NombreMascota = '".$_GET["nombre"]."'";
$sql .= " ORDER BY NombreMascota";
?>

<table border="0" cellpadding="0">
<th width="250">Cod. Mascota</th><th width="250">Nombre</th> <th width="250">Dueño</th><th width="250">Raza</th> <th width="250">Especie</th>

<?php
while ($acceso = mysql_fetch_array($sql)){
echo "<tr><td>".$acceso['IdMascota']."</td><td>".$acceso['NombreMascota']."</td><td>".$acceso['CLIENTE_IdCliente']."</td><td>".$acceso['RAZA_NombreRaza']."</td><td>".$acceso['EspecieMascota']."</td><td width='60'><a href='../fichamedica2.php?id=".$acceso['IdMascota']."'>Crear Historial</a></td></tr>";
}   

?>
</table>
pero me tira error, en linea 66 que seria esta
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\Vete\Mostrar\pruebaficha.php on line 66


while ($acceso = mysql_fetch_array($sql)){