Este es el codigo
Código PHP:
$buscar = $_POST['Bucar'];
$tipo = $_POST['tipoi'];
$op = $_POST['operacion'];
$conexion = mysql_connect($dbhost,$dbusername,$dbuserpass) or die ("Error: Problema al conectar con el Host");
$db = mysql_select_db($dbname,$conexion) or die ("Error: Problema al conectar con la Base de datos");
$query = mysql_query("SELECT id_inmueble,tipo,ubicacion,mts2,precio,operacion FROM inmuebles WHERE inmuebles.tipo= '$_POST[tipoi]' AND inmuebles.operacion='$_POST[operacion]'") or die ("Error en query");
$cont = mysql_num_rows($query);
$datos = mysql_fetch_assoc($query);
$id_inmueble = $datos['id_inmueble'];
if ($cont == 0){
print '<h2> No se encontaron resultados para su busqueda!</h2>';
}
else{
print '<table width="470" border="0" cellspacing="0" cellpadding="0">';
while($datos = mysql_fetch_assoc($query))
{
$query3 = mysql_query("SELECT * FROM fotos2 INNER JOIN inmuebles_fotos ON fotos2.id_foto = inmuebles_fotos.id_foto WHERE inmuebles_fotos.id_inmueble=$id_inmueble") or die ("Error en query3");
$datos3 = mysql_fetch_array($query3);
$image_path = $datos3['path'];
print '<tr>
<td width="236" rowspan="7"><div align="center"><a href="Prueba2.php?id='.$datos['id_inmueble'].'"><img src="../'.$image_path.'" width="200" height="120" alt=""></a></div></td>
<td width="18" rowspan="8"><div align="center"></div></td>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><div align="left">'.$datos['tipo'].' en '.$datos['operacion'].'</div></td>
</tr>
<tr>
<td><div align="left">'.$datos['ubicacion'].'</div></td>
</tr>
<tr>
<td width="434"><div align="left">'.$datos['mts2'].' mts2</div></td>
</tr>
<tr>
<td><div align="left" class="Estilo1"> BsF '.$datos['precio'].'</div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td width="236"> </td>
<td><div align="right"></div></td>
</tr>';
}
print '</table>';
print '<br>';
print '<br>';
}