Ejemplo n.º 1
0
     } else {
         $limit = $an_pg;
     }
     $sql = empty(trim($row[0])) ? $sql_cab . "WHERE categoria_id = '{$_GET['categoria-actual']}'" : $sql_cab . "WHERE categoria_id IN ({$row[0]})";
     $sql .= "AND (latitud BETWEEN {$p1['lat']} AND {$p2['lat']}) AND (longitud BETWEEN {$p1['lon']} AND {$p2['lon']}) ";
     $sql .= "LIMIT " . $limit;
     //$sql .= "LIMIT 10";
     $result = BD::consultar($sql);
     if ($result) {
         $data = array();
         while ($row = mysqli_fetch_assoc($result)) {
             $data[] = $row;
         }
         mysqli_free_result($result);
         foreach ($data as &$anuncio) {
             $anuncio['imagenes'] = GM_busquedas_inmo::obtener_fotos_anuncio($anuncio["id"]);
         }
         echo json_encode($data);
         BD::desconectar();
     } else {
         echo 0;
     }
 } else {
     if ($_GET['accion'] == 'todos') {
         BD::conectar();
         $result = BD::consultar("SELECT hijos FROM categorias WHERE id = '{$_GET['categoria-actual']}'");
         $row = mysqli_fetch_row($result);
         mysqli_free_result($result);
         $sql = empty(trim($row[0])) ? $sql_cab . "WHERE categoria_id = '{$_GET['categoria-actual']}'" : $sql_cab . "WHERE categoria_id IN ({$row[0]})";
         $sql .= " AND (latitud BETWEEN {$p1['lat']} AND {$p2['lat']}) AND (longitud BETWEEN {$p1['lon']} AND {$p2['lon']}) ";
         $limit_fin = 'LIMIT ' . $pagina * $an_pg . ', 999999';
Ejemplo n.º 2
0
	        
	        <div class="formaFichas">
	            
	            <div class="grupoFichasTop gftac">';
    }
    if ($result) {
        while ($row = mysqli_fetch_assoc($result)) {
            $str .= '<div class="fichaInfo">
                    <div class="listaFichaIzq">';
            $ficha = '/' . GM_general::obtener_nombre_rr_categoria($row[$cat]) . '/' . GM_general::slugify($row['titulo']) . '-gm' . $prefijo . $row['id'] . '.htm';
            switch ($categoria) {
                case -2:
                    $img_arr = GM_busquedas_motor::obtener_fotos_anuncio($row['id']);
                    break;
                case -3:
                    $img_arr = GM_busquedas_inmo::obtener_fotos_anuncio($row['id']);
                    break;
                default:
                    $img_arr = GM_busquedas_motor::obtener_fotos_anuncio($row['id']);
                    break;
            }
            if (empty($img_arr)) {
                $img = '/img/templates/no-foto.gif';
            } else {
                $img = "/img/img_anuncios/" . $img_arr[0]['url'];
            }
            $precio = number_format($row['precio'], 0, ',', '.');
            if ($_POST['blq'] == 'ce') {
                if ($row['latitud'] != 0 && $row['longitud'] != 0) {
                    if ($row['distancia'] > 1) {
                        $distancia = number_format($row['distancia'], 0, ",", ".") . " Kms.";
Ejemplo n.º 3
0
<?php

include '../BD.class.php';
include "../GM_general.class.php";
if ($_GET['anuncio']) {
    BD::conectar();
    switch ($_GET['categoria-padre']) {
        case 'inmobiliaria':
            include "../GM_busquedas_inmo.class.php";
            $imgs = GM_busquedas_inmo::obtener_fotos_anuncio($_GET['anuncio']);
            echo json_encode($imgs);
            break;
        case 'motor':
            include '../GM_busquedas_motor.class.php';
            $imgs = GM_busquedas_motor::obtener_fotos_anuncio($_GET['anuncio']);
            echo json_encode($imgs);
            break;
    }
    BD::desconectar();
} else {
    echo 0;
}