Jump to content

baraktw

New Members
  • Posts

    4
  • Joined

  • Last visited

baraktw's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i have fixed that error but still not seeing hours in sunday. $stmt = $con->prepare(" Select * from appointments a where date(start_time) = ? and a.employee_id = ? and canceled = 0 and ((start_time >= ? and start_time <= ?) or (end_time_expected >= ? and end_time_expected <= ?)) and (start_time < end_time_expected) and ((start_time < ? and end_time_expected > ?) OR (start_time > ? and end_time_expected < ?)) "); $stmt->execute(array($appointment_date, $selected_employee, $start, $result, $start, $result, $start, $result, $start, $result)); $stmt_emp = $con->prepare(" Select employee_id from employees_schedule where employee_id = ? and day_id = ? and to_hour > ? and from_hour < ? "); $stmt_emp->execute(array($selected_employee,$day_id,$start, $result));
  2. still get that error tell me where i am wrong and if you can fix the code. i really grateful for your help until now. $stmt = $con->prepare(" Select * from appointments a where date(start_time) = ? and a.employee_id = ? and canceled = 0 and ((start_time >= ? and start_time <= ?) or (end_time >= ? and end_time_expected <= ?)) and (start_time < end_time_expected) and ((start_time < ? and end_time_expected > ?) OR (start_time > ? and end_time_expected < ?)) "); $stmt->execute(array($appointment_date,$selected_employee,$start,$result,$start,$result)); $stmt_emp = $con->prepare(" Select employee_id from employees_schedule where employee_id = ? and day_id = ? and to_hour > ? and from_hour < ? "); $stmt_emp->execute(array($selected_employee,$day_id,$start, $result));
  3. hello this script show in calander days and hours you can pick for appointment but i dont see sunday in the calander the config of the day is taking from DB can someone help me i think there is something here but cant fix that thank you alot $appointment_date = date('Y-m-d'); for($i = 0; $i <10; $i++) { $appointment_date = date('Y-m-d', strtotime($appointment_date . ' +1 day')); echo "<div class = 'appointment_day'>"; echo date('D', strtotime($appointment_date)); echo "<br>"; echo date('d', strtotime($appointment_date)); echo "</div>"; } <!-- NEXT 10 DAYS --> <div class="appointments_days"> <?php $appointment_date = date('Y-m-d'); for($i = 0; $i <10; $i++) { $appointment_date = date('Y-m-d', strtotime($appointment_date . ' +1 day')); echo "<div class = 'appointment_day'>"; echo date('D', strtotime($appointment_date)); echo "<br>"; echo date('d', strtotime($appointment_date)); echo "</div>"; } ?> </div> <!-- DAY HOURS --> <div class = 'available_booking_hours'> <?php //SELECTED SERVICES $desired_services = $_POST['selected_services']; //SELECTED EMPLOYEE $selected_employee = $_POST['selected_employee']; //Services Duration - End time expected $sum_duration = 0; foreach($desired_services as $service) { $stmtServices = $con->prepare("select service_duration from services where service_id = ?"); $stmtServices->execute(array($service)); $rowS = $stmtServices->fetch(); $sum_duration += $rowS['service_duration']; } $sum_duration = date('H:i',mktime(0,$sum_duration)); $secs = strtotime($sum_duration)-strtotime("00:00:00"); $open_time = date('H:i',mktime(9,0,0)); $close_time = date('H:i',mktime(22,0,0)); $start = $open_time; $secs = strtotime($sum_duration)-strtotime("00:00:00"); $result = date("H:i:s",strtotime($start)+$secs); $appointment_date = date('Y-m-d'); for($i = 0; $i < 10; $i++) { echo "<div class='available_booking_hours_colum'>"; $appointment_date = date('Y-m-d', strtotime($appointment_date . ' +1 day')); $start = $open_time; $secs = strtotime($sum_duration)-strtotime("00:00:00"); $result = date("H:i:s",strtotime($start)+$secs); $day_id = date('w',strtotime($appointment_date)); while($start >= $open_time && $result <= $close_time) { // Check If the employee is available $stmt_emp = $con->prepare(" Select employee_id from employees_schedule where employee_id = ? and day_id = ? and ? between from_hour and to_hour and ? between from_hour and to_hour "); $stmt_emp->execute(array($selected_employee,$day_id,$start, $result)); $emp = $stmt_emp->fetchAll(); //If employee is available if($stmt_emp->rowCount() != 0) { //Check If there are no intersecting appointments with the current one $stmt = $con->prepare(" Select * from appointments a where date(start_time) = ? and a.employee_id = ? and canceled = 0 and ( time(start_time) between ? and ? or time(end_time_expected) between ? and ? ) "); $stmt->execute(array($appointment_date,$selected_employee,$start,$result,$start,$result)); $rows = $stmt->fetchAll(); if($stmt->rowCount() != 0) { //Show blank cell } else { ?> <input type="radio" id="<?php echo $appointment_date." ".$start; ?>" name="desired_date_time" value="<?php echo $appointment_date." ".$start." ".$result; ?>"> <label class="available_booking_hour" for="<?php echo $appointment_date." ".$start; ?>"><?php echo $start; ?></label> <?php } } else { //Show Blank cell } $start = strtotime("+15 minutes", strtotime($start)); $start = date('H:i', $start); $secs = strtotime($sum_duration)-strtotime("00:00:00"); $result = date("H:i",strtotime($start)+$secs); } echo "</div>"; } ?> </div> </div> <?php } else { header('location: index.php'); exit(); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.