Ver Mensaje Individual
  #9 (permalink)  
Antiguo 26/04/2010, 15:06
arros
 
Fecha de Ingreso: noviembre-2009
Mensajes: 535
Antigüedad: 14 años, 5 meses
Puntos: 25
Respuesta: Ayuda por favor una consulta con DATE

aqui esta codigo fuente mas claro
Código PHP:
Ver original
  1. $pax = $_POST['pax'];
  2. $txtDate = $_POST['txtDate'];
  3. $chekDate = $_POST['chekDate'];
  4. $txtDate = strtotime($txtDate);
  5. $chekDate = strtotime($chekDate);
  6. $days = ceil(($chekDate + 3600) / 86400) - ceil($txtDate / 86400);
  7. $query = "SELECT * FROM precio JOIN hombre WHERE precio.check_in <= '".$txtDate."' AND precio.check_out >= '".$chekDate."' AND precio.id_hotel = hombre.id_hotel";
  8. $result = mysql_query($query, $GLOBALS['DB']);
  9.                                        while ($row = mysql_fetch_array($result))
  10.                                        {
  11.  $total_1 = $row['precio'] * $days;
  12.                                             $total_2 = $total_1 * $pax;
  13. printf ("Precio total por ".$days." noches para ".$pax." Personas: " . number_format($total_2, 2). "€");
  14.                                             echo "<br />";
porfavor ayudenme en esto:(