Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/09/2007, 14:32
reimonfranco
 
Fecha de Ingreso: febrero-2006
Mensajes: 858
Antigüedad: 18 años, 2 meses
Puntos: 4
error si no se encuentra

Hola, tengo una dudita:

Tengo unos campos almacenados en una bd mysql, y tengo un codigo que los muestra.. entonces el caso es que yo quiciera hacer de que si no hay tal registro te diga "Lo sentimos no se encontro lo solicitado"

este es mi codigo:

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'");
?>
                                <?
//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
GRACIAS
__________________
*La amistad se multiplica cuando se divide*