Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/09/2007, 14:51
Avatar de ginitofl
ginitofl
 
Fecha de Ingreso: diciembre-2006
Ubicación: Lima Perú
Mensajes: 349
Antigüedad: 17 años, 4 meses
Puntos: 22
Re: error si no se encuentra

pruab de esta manera:

Código PHP:
 <? 
//Conexion con la bd 
mysql_connect("localhost","bd","pass"); 

//seleccion de la bd con la que vamos a trabajar 
 
mysql_select_db("bd"); 
  
//Ejecucion de la sentencia sql 
$result mysql_query ("select * from propiedades where codigo='$codigo'"); 

if(
mysql_num_rows($result)==0)
{
echo 
"Lo sentimos no se encontro lo solicitado";
}
else
{

?> 

<? 
//mostramos los registros 
$row mysql_fetch_array($result); 
$codigo $row["codigo"]; 
echo 
"<table width='588' height='19' border='0' cellpadding='0' cellspacing='0'>"
echo 
"<tr><td width='588' height='19' valign='top'><div align='right'><a href='javascript:history.back()'>&lt;&lt;- Atrás</a></div></td></tr></table>"
echo 
"<table bgColor='#FFFFD2' align='center'>"
echo 
"<tr>"
echo 
"<td colspan='3'> <p align='center'> <font color='#000000' size='-1' face='Gill Sans MT'>".$row['titulo']."</font></p></td>"
echo 
"</tr>"
echo 
"<tr align='center'></tr><tr align='center'></tr><tr align='center'></tr>"
echo 
" <tr align='center'>"
echo 
" <td colspan='3'> <p align='center'> <font color='#666666' size='3' face='Gill Sans MT'>Código:".$row['codigo']."</font></p></td>"
echo 
" </tr>"
echo 
" <tr>"
echo 
" <td colspan='3' align='center'><p align='center'> <font color='#666666' size='3' face='Gill Sans MT'> Tipo de propiedad:"  .$row['tipo']."</font></p></td>"
echo 
" </tr>"
echo 
" <tr>"
echo 
" <td colspan='3' align='center'><p align='center'> <font color='#666666' size='3' face='Gill Sans MT'> Operación:"  .$row['operacion']."</font></p></td>"
echo 
" </tr>"
echo 
" <tr>"
echo 
" <td colspan='3' align='center'><p align='center'> <font color='#666666' size='3' face='Gill Sans MT'> Ubicación:"  .$row['ubicacion']."</font></p></td>"
echo 
" </tr>"
echo 
"<tr align='center'></tr><tr align='center'></tr>"
echo 
" <tr align='center'>"
echo 
" <td colspan='3'> <p align='center'> <font color='#666666' size='3' face='Gill Sans MT'>Precio:"   .$row['precio']."</p></td>"
echo 
"</tr>"
echo 
"<tr align='center'></tr><tr align='center'></tr><tr align='center'></tr>"
echo 
"<tr>"
echo 
"<td colspan='3'> <p align='center'> <font color='#666666' size='3' face='Gill Sans MT'>Descripcion:</p><p>".$row['descripcion']."</font></p></td></tr>"
echo 
"<tr>"
echo 
" <td colspan='3'> <p align='center'><font size='3' face='Gill Sans MT' color='#666666'><a href='fotos.php?codigo=$codigo'>VER FOTOS </a> | <a href='contacto_propiedades.php?codigo=$codigo'>CONTACTO</a> | <a href='javascript:window.print()'>IMPRIMIR</a></font></p></td>"
echo 
"</tr>"
echo 
"</table>"
}
?>
SALUDOS