Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/09/2008, 07:57
mindoata
 
Fecha de Ingreso: septiembre-2008
Mensajes: 136
Antigüedad: 15 años, 7 meses
Puntos: 1
Respuesta: Problemas con mi consulta

ahora estuve tratando con empty y me funciona bien cuando hay nuevas adquisiciones porque no pierdo ninguna fila, PERO cuando no la hay nuevas adquisiciones no sale el mensaje.
Osea que estoy en las mismas.

<?php
$db = odbc_connect('base','','');
if (!$db) {
exit('Error en la conexión a la base de datos');
} else {
$consulta = "SELECT * FROM Fichas where Clasificacion >= '007' and Clasificacion <= '099' and Fecha between #14/01/2008# and #30/08/2008#";

$result = odbc_exec($db,$consulta);
if (!$result) {
exit("Error en la consulta");
} else {

if(empty($result)){
echo'No Hay Nuevas Adquisiciones';
}else{
print "<table border=\"1\" align='center'>\n <tr>
<th>Fecha</th>\n <th>Titulo</th>\n <th>Autor</th>\n <th>ISBN</th>\n <th>Clasificacion</th>\n </tr>\n";
while ($valor = odbc_fetch_array($result)) {

$Fecha = $valor['Fecha'];
$Titulo = $valor['Titulo'];
if(!$valor['Autor']){
$Autor = ('NA');
}else{
$Autor = $valor['Autor'];
}
if(!$valor['ISBN']){
$ISBN = ('NI');
}else{
$ISBN = $valor['ISBN'];
}
$Clasificacion = $valor['Clasificacion'];


print " <tr>\n <td>$Fecha</td>\n <td>$Titulo</td>\n <td>$Autor</td>\n <td>$ISBN</td>\n <td>$Clasificacion</td> </tr>\n";

}
odbc_close($db);
print "</table>\n";

}
}

}
?>

Será que hay alguien que me pueda ayudar