Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/07/2011, 13:21
Avatar de jakuam
jakuam
 
Fecha de Ingreso: abril-2007
Mensajes: 354
Antigüedad: 19 años, 5 meses
Puntos: 0
Error : Warning: mysql_fetch_array(): supplied -

Necesito que me ayuden .. no puedo resolver el error .. por favor necesito su ayuda ...


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

Código PHP:
<?php
ob_start
();
include(
"conexion.inc");

if ( (isset(
$_GET["alojar_id"])) && ($_GET["alojar_id"]!="") ) { 
        
$alojar_id = $_GET["alojar_id"];
    
$arrdate_day = $_GET["arrDate_day"];
    
$arrdate_mon = $_GET["arrDate_mon"];
    
$arrdate_year = $_GET["arrDate_year"];
    
$deptdate_day = $_GET["deptDate_day"];
    
$deptdate_mon = $_GET["deptDate_mon"];
    
$deptdate_year = $_GET["deptDate_year"];
    
$paxs = $cant_pax;
    
$num_hab = $_GET["habitaciones"];
    
$pax1 = $_GET["pax1"];
    
$pax2 = $_GET["pax2"];
    
$pax3 = $_GET["pax3"];
    
$pax4 = $_GET["pax4"];
    
$pax5 = $_GET["pax5"];
    
$pax6 = $_GET["pax6"];
    
$pax7 = $_GET["pax7"];
    
$pax8 = $_GET["pax8"];
    
$web = $web;
}

$fecha_desde = $arrdate_year."-".$arrdate_mon."-".$arrdate_day;
$fecha_hasta = $deptdate_year."-".$deptdate_mon."-".$deptdate_day;

// Calculo timestam de las dos fechas...
$timestamp1 = mktime(0,0,0,$arrdate_mon,$arrdate_day,$arrdate_year);
$timestamp2 = mktime(0,0,0,$deptdate_mon,$deptdate_day,$deptdate_year);

// Resto a una fecha la otra...
$segundos_dif = $timestamp1 - $timestamp2; 

// Convierto segundos en días...
$dias_dif = $segundos_dif / (60 * 60 * 24); 

// Obtengo el valor absoluto de los días (quito el posible signo negativo)...
$dias_dif = abs($dias_dif); 

// Quito los decimales a los días de diferencia...
$dias_dif = floor($dias_dif); 

// Listo...
$nro_dias = $dias_dif;
if (
$nro_dias == 0) {
    
$nro_dias = 1;
}

// Constantes...
$anho_minimo = 2010;
$anho_maximo = 2030;

$Lunes = "Lun";
$Martes = "Mar";
$Miercoles = "Mie";
$Jueves = "Jue";
$Viernes = "Vie";
$Sabado = "Sab";
$Domingo = "Dom";

$Enero = "Enero";
$Febrero = "Febrero";
$Marzo = "Marzo";
$Abril = "Abril";
$Mayo = "Mayo";
$Junio = "Junio";
$Julio = "Julio";
$Agosto = "Agosto";
$Setiembre = "Setiembre";
$Octubre = "Octubre";
$Noviembre = "Noviembre";
$Diciembre = "Diciembre";

?>


<?php

//Seteando...
$ver_detalles = false;


//Leyendo habitacion con maximo pax...
$maximo = 0;
$sSQL = "SELECT max(pax_max) as maximo";
$sSQL .= " FROM habitaciones";
$sSQL .= " WHERE pax_max <= ".$paxs;
$result = mysql_query($sSQL,$link);
if (
$fila = mysql_fetch_array($result)) {
    
$maximo = $fila["maximo"];
};
if (
$maximo > $paxs) {
    
$maximo = $paxs;
}

//Obteniendo combinaciones posibles...
$combina[] = array(0,0,0,0,0,0,0,0);
$combina[0] = $pax1;
$combina[1] = $pax2;
$combina[2] = $pax3;
$combina[3] = $pax4;
$combina[4] = $pax5;
$combina[5] = $pax6;
$combina[6] = $pax7;
$combina[7] = $pax8;
rsort($combina);
if (
$ver_detalles == true) {
    echo 
"<p>Combinaciones Posibles:";
    echo 
"<br>".$combina[0]." ".$combina[1]." ".$combina[2]." ".$combina[3]." ".$combina[4]." ".$combina[5]." ".$combina[6]." ".$combina[7];
}

//Seteando condicion comun...
$sCondComun = " AND c.cant_disponible >= 0";
$sCondComun .= " AND c.estado_bloqueo = 'A'";
$sCondComun .= " AND c.tarifa_normal > 0";
if (
$nro_dias == 1) {
    
$sCondComun .= " AND c.fecha = '".$fecha_desde."'";
}
else {
    
$sCondComun .= " AND c.fecha >= '".$fecha_desde."'";
    
$sCondComun .= " AND c.fecha < '".$fecha_hasta."'";
}

//Leyendo habitaciones disponibles para primer dia...
$contpaxmax[] = array(0,array(0,0));
$pos_cpm_pax_max = 0;
$pos_cpm_total = 1;
$bNuevoCPM = true;
$pos_pax_max = 0;
$pos_id_habitacion = 1;
$pos_nombre_hab = 2;
$pos_tipo_hab = 3;
$pos_desayuno=4;
$pos_servicio_hab=5;
$pos_cant_disponible = 6;
$pos_total = 7;
$pos_reservar = 8;
$pos_procesado = 9;
$habipri[] = array(0,array(0,0,0,0,0,0,0,0,0,0));
$sSQL = "SELECT h.pax_max,";
$sSQL .= " c.id_habitacion,";
$sSQL .= " h.nombre_hab,";
$sSQL .= " h.tipo_hab,h.desayuno,h.servicio_hab,";
$sSQL .= " MIN(c.cant_disponible) as cant_disponible";
$sSQL .= " FROM cal_calendario c, habitaciones h";
$sSQL .= " WHERE h.hab_id = c.id_habitacion";
$sSQL .= " AND h.alojar_id = ".$alojar_id;
$sSQL .= " AND h.pax_max <= ".$maximo;
$sSQL .= $sCondComun;
$sSQL .= " GROUP BY 1, 2, 3, 4";
$sSQL .= " ORDER BY pax_max DESC, id_habitacion";
$result = mysql_query($sSQL,$link);
if (
$fila = mysql_fetch_array($result)) {
    
$iFila = 0;
    
$iFilaCPM = 0;
    do {
        
$habipri[$iFila][$pos_pax_max] = $fila["pax_max"];
        
$habipri[$iFila][$pos_id_habitacion] = $fila["id_habitacion"];
        
$habipri[$iFila][$pos_nombre_hab] = $fila["nombre_hab"];
        
$habipri[$iFila][$pos_tipo_hab] = $fila["tipo_hab"];
        
        
$habipri[$iFila][$pos_servicio_hab] = $fila["servicio_hab"];
        
$habipri[$iFila][$pos_desayuno] = $fila["desayuno"];
        
$habipri[$iFila][$pos_cant_disponible] = $fila["cant_disponible"];
        
$habipri[$iFila][$pos_total] = 0;
        
$habipri[$iFila][$pos_reservar] = "S";
        
$habipri[$iFila][$pos_procesado] = "N";
        if (
$iFila == 0) {
            
$bNuevoCPM = true;
        }
        else {
            if (
$contpaxmax[$iFilaCPM][$pos_cpm_pax_max] == $fila["pax_max"]) {
                
$bNuevoCPM = false;
            }
            else {
                
$iFilaCPM = $iFilaCPM + 1;
                
$bNuevoCPM = true;
            }
        }
        if (
$bNuevoCPM == true) {
            
$contpaxmax[$iFilaCPM][$pos_cpm_pax_max] = $fila["pax_max"];
            
$contpaxmax[$iFilaCPM][$pos_cpm_total] = 1;
        }
        else {
            
$contpaxmax[$iFilaCPM][$pos_cpm_total] = $contpaxmax[$iFilaCPM][$pos_cpm_total] + 1;
        }
        
$iFila = $iFila + 1;
    } while (
$fila = mysql_fetch_array($result));
};
if (
$ver_detalles == true) {
    echo 
"<p>Habipri (Habitaciones Disponibles para el primer dia - Incluye 0 (Cero, sin disponibilidad) para permitir solicitar)...";
    for (
$i=0; $i<sizeof($habipri); $i++) {
        echo 
"<br>Hab: ".$i." Pax Max: ".$habipri[$i][$pos_pax_max]." Id Habitacion: ".$habipri[$i][$pos_id_habitacion]." Cant. Disponible: ".$habipri[$i][$pos_cant_disponible];
    }
    echo 
"<p>ContPaxMax (Total de Habitaciones por Pax_Max)...";
    for (
$i=0; $i<sizeof($contpaxmax); $i++) {
        echo 
"<br>Pos: ".$i." Pax Max: ".$contpaxmax[$i][$pos_cpm_pax_max]." Total: ".$contpaxmax[$i][$pos_cpm_total];
    }
}

//Leyendo habitaciones disponibles para rango de fechas...
$pos_det_id_habitacion = 0;
$pos_det_numero_int = 1;
$pos_det_fecha = 2;
$pos_det_pax_max = 3;
$pos_det_tarifa_normal = 4;
$pos_det_tarifa_oferta = 5;
$pos_det_dia_semana = 6;
$pos_det_desc_dia_semana = 7;
$pos_det_disponible = 8;
$habigen[] = array(0,array(0,0,0,0,0,0,0,0,0));
$habigendet[] = array(0,array(0,0,0,0,0,0,0,0));
$iFila = 0;
$iFilaDet = 0;
for (
$i=0; $i<sizeof($habipri); $i++) {
    
$pre_habigendet[] = array(0,array(0,0,0,0,0,0,0,0));
    
$sSQL = "SELECT c.id_habitacion,";
    
$sSQL .= " c.fecha,";
    
$sSQL .= " h.pax_max,";
    
$sSQL .= " c.tarifa_normal,";
    
$sSQL .= " c.tarifa_oferta,";
    
$sSQL .= " day(c.fecha) as dia,";
    
$sSQL .= " weekday(c.fecha) as dia_semana,";
    
$sSQL .= " cant_disponible";
    
$sSQL .= " FROM cal_calendario c, habitaciones h";
    
$sSQL .= " WHERE h.hab_id = c.id_habitacion";
    
$sSQL .= " AND c.id_habitacion = ".$habipri[$i][$pos_id_habitacion];
    
$sSQL .= $sCondComun;
    
$sSQL .= " ORDER BY c.fecha";
    
$result = mysql_query($sSQL,$link);

    if (
$fila = mysql_fetch_array($result)) {

.........
.....
....
...
}
?>
__________________
Jakuam
Reserva Hoteles Online
Turismo San Rafael Mendoza