|    
			
				20/02/2008, 11:55
			
			
			  | 
  |   |  |  |  |  Fecha de Ingreso: noviembre-2007 
						Mensajes: 136
					 Antigüedad: 17 años, 11 meses Puntos: 0 |  | 
  |  Re: porke mi consulta me duplica los registros  
  enseguida hago la consulta con varios criterios
 <table border=1 align=center width=100%>
 <tr>
 <th BGCOLOR = #FFAA56>FOTOS</th>
 <th BGCOLOR = #FFAA56>DETALLES</th>
 </tr>
 <?php
 include("conexion.php");
 
 $tipo = $_POST['tipo'];
 $categoria = $_POST['categoria'];
 $precioinicial =$_POST['precioinicial'];
 $preciofinal =$_POST['preciofinal'];
 $disponible =$_POST['disponible'];
 $nivel =$_POST['nivel'];
 $nh =$_POST['nh'];
 $nb =$_POST['nb'];
 $coches =$_POST['coches'];
 $estudio =$_POST['estudio'];
 $cs =$_POST['cs'];
 $alberca =$_POST['alberca'];
 $tel =$_POST['tel'];
 $internet =$_POST['internet'];
 
 //aki es donde se hace la consulta de acuerdo a los criterios
 $query = "SELECT * from vivienda,detalle_vivienda where 1 = 1";
 if ($tipo !== "opc")
 {$query.= " AND tipo_v = '{$tipo}'";}
 if ($categoria !== "opc")
 {$query.= " AND categoria = '{$categoria}'";}
 if (($precioinicial !== "opc")&&($preciofinal == "opc"))
 {$query.= " AND precio >= $precioinicial";}
 if (($precioinicial == "opc")&&($preciofinal !== "opc"))
 {$query.= " AND precio <= $preciofinal";}
 if ($disponible !== "opc")
 {$query.= " AND disponible = '{$disponible}'";}
 if ($nivel !== "opc")
 {$query.= " AND niveles = '{$nivel}'";}
 if ($nh !== "opc")
 {$query.= " AND detalle_vivienda.n_habitacion = '{$nh}'";}
 if ($nb !== "opc")
 {$query.= " AND detalle_vivienda.n_bath = '{$nb}'";}
 if ($coches !== "opc")
 {$query.= " AND detalle_vivienda.est = '{$coches}'";}
 if ($estudio !== "opc")
 {$query.= " AND detalle_vivienda.estudio = '{$estudio}'";}
 if ($cs !== "opc")
 {$query.= " AND detalle_vivienda.cuarto_service = '{$cs}'";}
 if ($alberca !== "opc")
 {$query.= " AND detalle_vivienda.alberca = '{$alberca}'";}
 if ($tel !== "opc")
 {$query.= " AND detalle_vivienda.tel = '{$tel}'";}
 if ($internet !== "opc")
 {$query.= " AND detalle_vivienda.internet = '{$internet}'";}
 
 
 $res=mysql_query($query);
 
 //aki es donde se muestra la consulta
 while ($datos=mysql_fetch_array($res))
 {
 //echo $critero;
 echo "<tr>
 <td> CLAVE DE VIVIENDA .$datos[0].<BR>
 NOMBRE DE LA VIVIENDA:.$datos[1].<BR>
 TIPO DE VIVIENDA:.$datos[2].<BR>
 LUGAR:.$datos[5].<BR>
 TAMAÑO DE LA PROPIEDAD: .$datos[6].<BR>
 PRECIO:.$datos[7].<BR>
 DISPONIBLE: .$datos[8].<BR>
 </td>
 <td></td>
 </tr>";
 }
 ?>
 </table>
 
 pero cada registro me lo pone doble
 porke?
     |