Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/01/2014, 15:10
helenp
 
Fecha de Ingreso: mayo-2009
Mensajes: 382
Antigüedad: 17 años, 4 meses
Puntos: 6
incompatibilidad query con sessiones?????

Hola,
Esto no lo entiendo absolutamente nada, he hecho todas las clases de pruebas.
Sé que tengo que migrar a mysqli y lo haré con estas paginas cuando termino con el script.

Este query funciona ya que lo uso actualmente, pero al cambiar el script y añadir sessiones pues el query o no se ejecuta o da falso.
Por debajo del query he hecho dos echos y imprime las variables, pero no el echo que está dentro del query.

Código PHP:
$result = mysql_query ("SELECT Duermen_max, bond FROM Casas_alquilar where nombre = '$propiedad'");
while (
$row = mysql_fetch_object($result)) {
echo 
"<p>Máx. occupancy is ". $row->Duermen_max ."  persons excluding babies or infants who sleep in a cot for which there is no extra charge.</p>";
echo 
"<p> Date of occupancy:  Arrival $arrive &nbsp; &nbsp; &nbsp; Departure $depart</p>";
}
echo 
$propiedad;
echo 
$arrive; 
Este echo que está dentro del while que no tiene nada que ver con el query no se imprime:
echo "<p> Date of occupancy: Arrival $arrive &nbsp; &nbsp; &nbsp; Departure $depart</p>";
De mientras el echo fuera del query si se imprime.
No tiene sentido.
Puede haber alguna clase de incompatibilidad?
He puesto el query arriba del todo, para aseguar y despues de las variables.

Este es el codigo desde arriba hasta los dos echos que si se imprime (quitando el html:
Código PHP:
<?php 
ini_set
("session.cookie_lifetime","3600");
ini_set("session.gc_maxlifetime","3600");
session_start(); 
header('Content-type: text/html; charset=utf-8');
if  ( !
$_SERVER['HTTPS'] )
        {
                
$host = $_SERVER['HTTP_HOST'];
                
$request_uri = $_SERVER['REQUEST_URI'];
                
$good_url = "https://" . $host . $request_uri;

                
header( "HTTP/1.1 301 Moved Permanently" );
                
header( "Location: $good_url" );
                exit;
        } 
        if( !isset(
$_SESSION['reservas']) || ( !isset($_SESSION['reservas']['paso1']) || empty($_SESSION['reservas']['paso1'])) 
        || ( !isset(
$_SESSION['reservas']['paso2']) || empty($_SESSION['reservas']['paso2'])) ){
header('Location: bookingchoices.php');
}
include 
'paypal/conexionbase.php';
?>
<?php
echo "<pre>";
print_r($_SESSION['reservas']);
echo 
"</pre>";  
$propiedad=$_SESSION['reservas']['paso1']['propiedad'];
$percentage=$_SESSION['reservas']['paso1']['percentage'];
$paynow=$_SESSION['reservas']['paso2']['paynow'];
$half_round=$_SESSION['reservas']['paso2']['half_round'];
$balance=$_SESSION['reservas']['paso2']['balance'];
$whenpayment=$_SESSION['reservas']['paso2']['whenpayment'];
$arrive=$_SESSION['reservas']['paso2']['arrive'];
$depart=$_SESSION['reservas']['paso2']['depart'];
$llegada2 = htmlspecialchars($_POST['llegada2']); 
$salida2 = htmlspecialchars($_POST['salida2']);
     
$email = htmlspecialchars($_POST['email']); 
      
$name = htmlspecialchars($_POST['name']);
     
$passport = htmlspecialchars($_POST['passport']);
     
$emailtrue = htmlspecialchars($_POST['emailtrue']);
     
$repeat_email = htmlspecialchars($_POST['repeat_email']);
      
$telhome = htmlspecialchars($_POST['telhome']);
       
$telmobile = htmlspecialchars($_POST['telmobile']);
        
$adults = htmlspecialchars($_POST['adults']);
        
$children = htmlspecialchars($_POST['children']);
        
$babies = htmlspecialchars($_POST['babies']);
       
$holidaycost = htmlspecialchars($_POST['holidaycost']);
              
$deposit = htmlspecialchars($_POST['deposit']);
           
$topay = htmlspecialchars($_POST['topay']);
       
$damagedeposit = htmlspecialchars($_POST['damagedeposit']);
              
$transport = htmlspecialchars($_POST['transport']);
       
$hour = htmlspecialchars($_POST['hour']);
       
$hour2 = htmlspecialchars($_POST['hour2']);
       
$minutes = htmlspecialchars($_POST['minutes']);
       
$minutes2 = htmlspecialchars($_POST['minutes2']);
       
$hourarrival = $hour.":".$minutes;
$hourdeparture = $hour2.":".$minutes2;
$arrivalflightdetails = htmlspecialchars($_POST['arrivalflightdetails']);
$departureflightdetails = htmlspecialchars($_POST['departureflightdetails']);
$taxismall = htmlspecialchars($_POST['taxismall']);
$taxibig = htmlspecialchars($_POST['taxibig']);
$taxismall2 = htmlspecialchars($_POST['taxismall2']);
$taxibig2 = htmlspecialchars($_POST['taxibig2']);
$rentacar = htmlspecialchars($_POST['rentacar']);
$cot = htmlspecialchars($_POST['cot']);
$otherservices = htmlspecialchars($_POST['otherservices']);
                 
$result = mysql_query ("SELECT Duermen_max, bond FROM Casas_alquilar where nombre = '$propiedad'");
while (
$row = mysql_fetch_object($result)) {
            echo 
"<p>Máx. occupancy is ". $row->Duermen_max ."  persons excluding babies or infants who sleep in a cot for which there is no extra charge.</p>";
            echo 
"<p> Date of occupancy:  Arrival $arrive &nbsp; &nbsp; &nbsp; Departure $depart</p>";
}
echo 
$propiedad;
echo 
$arrive;
  
?>
Es tan raro que será alguna tontería me imagino porque no me explico.
Gracias