Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/09/2007, 15:21
LIVERPOOL
 
Fecha de Ingreso: mayo-2004
Mensajes: 130
Antigüedad: 19 años, 11 meses
Puntos: 0
validar consulta

buenas tardes amigos, tengo una consulta que he realizado a la base datos y necesito su ayuda por lo siguiente, en el caso que la tabla consultada no contenga los registros con los parametro solicitados que script debo colocar, mi código es este:

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><div align="center"><img src="imagenes/noticias/pepitas_total_r1_c1.gif" width="480" height="22"></div></td>
</tr>
<tr>
<td valign="top" background="imagenes/noticias/pepitas_total_r2_c1.gif"><div align="center">
<?php
$sqlpep = "select * from noticias where tipo = 'Pepitas' order by idnoticia desc limit 8";
$consultapep = mysql_query($sqlpep) or die("No se puede ejecutar la consulta");
?>
<?php
while ($rspep = mysql_fetch_assoc($consultapep)){
?>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="2%" valign="middle"><div align="center"></div></td>
<td width="98%"><div align="left"><span class="fechanoticias">
<?php
setlocale(LC_CTYPE, 'es');
setlocale (LC_TIME,"spanish");
$fecha=$rspep['fecha'];
echo str_replace ("De","de",ucwords(strftime("%A, %d de %B de %Y", mktime(substr($fecha,11,2),substr($fecha,14,2),sub str($fecha,17,2),substr($fecha,5,2),substr($fecha, 8,2),substr($fecha,0,4)))));
?>
</span> <br>
</div> <div align="left"><span class="fechanoticias">
</span> <span class="fechanoticias"> </span></div></td>
</tr>
<tr>
<td valign="middle"> <div align="left"></div> <div align="left"><img src="imagenes/item_2.gif" width="5" height="10"><br>
</div></td>
<td width="98%"><div align="left"><span class="titular"><?php echo $rspep['titulo'];?></span></div></td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td width="98%" valign="top">
<div align="left"></div>
<div align="left"><?php echo '<a class="textonoticias" href="noticia.php?id='.$rspep['idnoticia'].'">'.substr($rspep['cuerpo'],0,100)."...";?></div></td>
</tr>
</table>
<?php
}
?>
<br>
</div></td>
</tr>
<tr>
<td valign="top"><div align="center"><img src="imagenes/noticias/pepitas_total_r3_c1.gif" width="480" height="22"></div></td>
</tr>
</table>

al ejecutarlo me devuelve los resultados correctamente pero en el caso que no me devuelva ningún registro kisiera que me devuelva un mensaje que diga que no hay registros o resultados, como puedo hacer eso.
Se los voy a agredecer mucho.