[ea_bootstrap width=»100%» scroll_off=»true» layout_cols=»2″]
[insert_php]

$servername = «db719171194.db.1and1.com»;
$username = «dbo719171194»;
$password = «zJErKZDpFJrsqRthDbnc»;
$dbname = «db719171194»;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(«Connection failed: » . $conn->connect_error);
}

//$sql = «SELECT DATE_FORMAT(aa.created, ‘%d/%m/%Y’) AS data_creat, DATE_FORMAT(aa.date, ‘%d/%m/%Y’) AS data_reserva, al.name AS nom_hotel, ass.name AS nom_servei, ast.name AS nom_massatgista FROM aOjJOCXWea_appointments AS aa INNER JOIN aOjJOCXWea_locations AS al ON aa.location = al.id INNER JOIN aOjJOCXWea_staff AS ast ON aa.worker = ast.id INNER JOIN aOjJOCXWea_services AS ass ON aa.service = ass.id WHERE aa.location = 15»;

$sql = «SELECT DATE_FORMAT(aa.created, ‘%d/%m/%Y’) AS data_creat, DATE_FORMAT(aa.date, ‘%d/%m/%Y’) AS data_reserva, al.name AS nom_hotel, ass.name AS nom_servei, ast.name AS nom_massatgista, af.value AS habitacio FROM aOjJOCXWea_appointments AS aa INNER JOIN aOjJOCXWea_locations AS al ON aa.location = al.id INNER JOIN aOjJOCXWea_staff AS ast ON aa.worker = ast.id INNER JOIN aOjJOCXWea_fields AS af ON aa.id = af.app_id INNER JOIN aOjJOCXWea_services AS ass ON aa.service = ass.id WHERE af.field_id = 5 ORDER BY data_reserva ASC»;

$sql_from = «SELECT DATE_FORMAT(aa.created, ‘%d/%m/%Y’) AS data_creat, DATE_FORMAT(aa.date, ‘%d/%m/%Y’) AS data_reserva, al.name AS nom_hotel, ass.name AS nom_servei, ast.name AS nom_massatgista, af.value AS habitacio FROM aOjJOCXWea_appointments AS aa INNER JOIN aOjJOCXWea_locations AS al ON aa.location = al.id INNER JOIN aOjJOCXWea_staff AS ast ON aa.worker = ast.id INNER JOIN aOjJOCXWea_fields AS af ON aa.id = af.app_id INNER JOIN aOjJOCXWea_services AS ass ON aa.service = ass.id WHERE af.field_id = 5 AND aa.date >= CURDATE() ORDER BY data_reserva ASC»;

$result = $conn->query($sql);
$result_from = $conn->query($sql_from);

echo ‘

‘;
echo ‘

‘;

if ($result_from->num_rows > 0) {

// output data of each row
$array_dates_from = array();
$cont_from = 0;
while($row_from = $result_from->fetch_assoc()) {
$array_dates_from[] = $row_from[«booking_date»];

echo ‘

  • ‘.$row_from[«data_reserva»].’

    Hotel: ‘ . utf8_encode($row_from[«nom_hotel»]). ‘
    Habitación: ‘ .utf8_encode($row_from[«habitacio»]). ‘
    Servicio: ‘ .utf8_encode($row_from[«nom_servei»]). ‘
    Masajista: ‘ .utf8_encode($row_from[«nom_massatgista»]). ‘
    Reserva hecha el ‘.$row_from[«data_creat»].’

  • ‘;

    $cont_from++;
    }
    } else {
    echo «

    No hay reservas.

    «;
    }

    echo ‘

    ‘;

    echo ‘

    ‘;
    echo ‘

    ‘;

    if ($result->num_rows > 0) {

    // output data of each row
    $array_dates = array();
    $cont = 0;
    while($row = $result->fetch_assoc()) {
    $array_dates[] = $row[«booking_date»];

    echo ‘

  • ‘.$row[«data_reserva»].’

    Hotel: ‘ . utf8_encode($row[«nom_hotel»]). ‘
    Habitación: ‘ .utf8_encode($row[«habitacio»]). ‘
    Servicio: ‘ .utf8_encode($row[«nom_servei»]). ‘
    Masajista: ‘ .utf8_encode($row[«nom_massatgista»]). ‘
    Reserva hecha el ‘.$row[«data_creat»].’

  • ‘;

    $cont++;
    }
    } else {
    echo «

    No hay reservas.

    «;
    }

    echo ‘

    ‘;

    $conn->close();

    [/insert_php]