Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/06/2011, 03:34
sidneyendis
Invitado
 
Mensajes: n/a
Puntos:
Pregunta Como crear página detalle.php???

Buenos días compañeros!

Os comento mi problema:
Estoy creando una web para una inmobiliaria, he creado un buscador avanzado el cual muestra el listados de propiedades, el problema viene ahora, quiero enlazar cada registro del listado a la pagina detalles.php y que en dicha página muestre más detalladamente la propiedad (No se si me he explicado bien jeje).

En [URL="http://www.forosdelweb.com/f18/crear-pagina-detalle-anuncio-853910/"]este link[/URL] explican como hacerlo, pero a mi no me funciona.

Os pongo mi código:

Resultados.php:
Código PHP:
<?php 
                           $item
=mysql_query("SELECT * FROM propiedades ORDER BY precio ASC LIMIT 0,5");
                           while (
$registro mysql_fetch_array($item)) {
                           
?>
                           <?php $id $registro['id']; // código insertado del link?> 
                                                           <div class="item">
                                <table>
                                <tr>
                                <td><img src="fotos/<?php echo $registro['foto']; ?>" alt="" width="84" height="84" /></td>
                                <td><?php echo $registro['descripcion']; ?></td>
                                </tr>
                                <tr>
                                <td><a href="detalles.php?$id_anuncio=<?php echo $id;// código insertado del link?>">Más información</a></td> 
                                <td><div style="background-color:#FFFFFF; color: #F90;padding-top:4px; padding-bottom:4px;"><b>Precio: <?php echo $registro['precio']; ?> ,-€</b></div></td>
                                </tr>
                                </table>
                                </div>
                            <?php 
                            
// termina la zona de repeticion
                            
mysql_free_result($item); // se libera la memoria usada por la tabla
                            
?>
Y este es el código de detalles.php:

Código PHP:
<?php
                                $id 
$_GET['id']; // código insertado del link
                                
$sql=mysql_query ("SELECT  propiedades.*, ciudades.*, tipoinmuebles.* precio FROM propiedades, ciudades, tipoinmuebles WHERE propiedades.idciudad = ciudades.id AND propiedades.idinmueble = tipoinmuebles.id  AND id ='$id_anuncio'");// código insertado del link
                                
while ($registro mysql_fetch_array($sql)) {    
                            
?>
                            <div id="detalles">
                              <table width="550" border="1">
                                <tr>
                                  <th colspan="2" scope="col"><img width="600" height="450" src="fotos/<?php echo $registro['foto']; ?>"> </th>
                                </tr>
                                <tr>
                                  <th colspan="2" scope="row">Ref.<?php echo $registro['titulo']; ?>  - <?php echo $registro['titulo']; ?></th>
                                </tr>
                                <tr> 
                                  <th colspan="2" scope="row" align="center">CARACTERÍSTICAS</th>
                                </tr>                                
                                <tr>
                                  <th scope="row">Tipo de propiedad:</th>
                                  <td><?php echo $registro['tipo']; ?></td>
                                </tr>
                                <tr>
                                  <th scope="row">Población:</th>
                                  <td><?php echo $registro['nombre']; ?></td>
                                </tr>
                                <tr>
                                  <th scope="row">Metros cuadrados:</th>
                                  <td><?php echo $registro['mtscuadrados']; ?></td>
                                </tr>
                                <tr>
                                  <th scope="row">Dormitorios:</th>
                                  <td><?php echo $registro['habitaciones']; ?></td>
                                </tr>
                                <tr>
                                  <th colspan="2" scope="row"><u><i>Descripción:</i></u> <?php echo $registro['descripcion']; ?></th>
                                </tr>
                                <tr>
                                  <th colspan="2" scope="row"><u><i>PRECIO:</i></u> <?php echo $registro['precio']; ?></th>
                                </tr>
                              </table>             
                              </div> 
                              <?php 
                              

                              
?>
Ah! os he colocado unos cometarios "código insertado del link" para que busquéis como locos donde está el código copiado del link.

Gracias de antemano!! Un saludo!!