Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/08/2007, 21:28
Avatar de jimadri
jimadri
 
Fecha de Ingreso: julio-2006
Ubicación: Buenos Aires
Mensajes: 487
Antigüedad: 17 años, 10 meses
Puntos: 1
No Se Han Encontrado Registros

Tengo el siguiente script en donde veo mi error. Mi propodito es que cuando no se encuentren registros se muestren las letras del abecedario y la leyenda "No se han encontrado registros"
Que estoy haciendfo mal??????

Código PHP:
<table width="632" height="248" border="0" class="texto">
 <tr>
 <td width="470" valign="top" class="letra">
      
      <?
        
include ("coneccion.inc");

    if (!empty(
$_GET['letra']))

    {
       
   
$coneccion mysql_connect($host_db$usuario_db$pass_db);
   
mysql_select_db($base_db$coneccion);
   
   
// Armo la consulta
   
$sql "SELECT * FROM hoteles, categoria, ciudad
        WHERE nombre like '$letra%'"
;
    
$sql.=" AND cod_categoria = id_cat";
    
$sql.=" AND cod_ciudad = id_ciudad ORDER BY nombre";
   
$result mysql_query($sql$coneccion);
  
   
   
   if (
mysql_error())
    {
        echo 
"ERROR al agregar la ciudad - "mysql_errno().":"mysql_error()."<br>";
    }

        
?>

        <?php
     
foreach(range('1''9') as $letra) {
         echo 
"<a href=\"hoteles2.php?letra=$letra\"> ".$letra." </a>"
    }
    foreach(
range('A''Z') as $letra) {
       echo 
"<a href=\"hoteles2.php?letra=$letra\"> ".$letra." </a>"
    }
    
        
?>

        <?
        $titulo_letra
$_GET['letra']
        
?>
        
<table border="0" width="105%" cellpadding="4" cellspacing="0">
<tr class="Titulo">
<td width="11%" align="left"></td>
<td width="89%" align="left"> <? echo "$titulo_letra";?> </td>
</tr>
</table>

<?
  
  
while($myrow mysql_fetch_array($result))
    
    {

      
// Armo link para editar
      
$detalle "tarifas.php?cod_hotel=$myrow[id_hotel]";
         
?>
<table width="470" border="0">
  <tr>
    <td width="122" rowspan="2"><? echo "<img src=$myrow[logo]>"?></td>
    <td width="338"><? echo $myrow[nombre]; ?></td>
  </tr>
  <tr>
    <td height="47" valign="top"><? echo "<img src=$myrow[estrellas]>"?><br><? echo $myrow[desc_ciudad]; ?></td>
  </tr>
</table>

<?
}
}
else
{
?> 

<?php
     
foreach(range('1''9') as $letra) {
         echo 
"<a href=\"hoteles2.php?letra=$letra\"> ".$letra." </a>"
    }
    foreach(
range('A''Z') as $letra) {
       echo 
"<a href=\"hoteles2.php?letra=$letra\"> ".$letra." </a>" 
       
    }
    
?>
    <table width="467" border="0">
  <tr>
    <td><div align="center">NO SE HAN ENCONTRADO REGISTROS </div></td>
  </tr>
</table>
    <?
        
}
        
?>
<br>


</td>

<td width="152" align="left" valign="top"><div align="center"><br>
    <img src="foto01.jpg" width="152" height="115"><img src="foto02.jpg" width="152" height="115"><img src="foto03.jpg" width="152" height="115"><br>
</div></td>
    </tr>
  </table>