<?php
$bg = '#eeeeee';
$sql->query("SELECT doctor_doctor.doctor_id, doctor_doctor.first_name AS first_name, doctor_doctor.last_name AS last_name, doctor_schedule.doctor_id, doctor_schedule.schedule_date AS date, doctor_schedule.time AS time, doctor_schedule.location_id
FROM doctor_doctor, doctor_schedule
WHERE THE WEEK OF 2013--01-01 AND doctor_doctor.doctor='1' AND doctor_doctor.doctor_id=doctor_schedule.doctor_id AND doctor_schedule.location_id='1'
ORDER BY date DESC");
$row = $sql->fetch_all();
// var_dump($row);
foreach($row as $r){
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee');
echo '<tr bgcolor="' . $bg . '">';
echo '<td height="25" width="150">'.$r['first_name'].' '.$r['last_name'].'</td><td height="25" width="150"> '.$r['date'].'</td><td height="25" width="150"> '.$r['time'].'</td>';
echo '</tr>';
}
?>
CREATE FUNCTION `date_is_in_week_of`(`test_date` date, `ref_date` date) RETURNS tinyint(1)
BEGIN
RETURN test_date BETWEEN date_sub(ref_date, interval weekday(ref_date) day)
AND date_add(ref_date, interval 6-weekday(ref_date) day);
END
SELECT Field1, Field2
FROM my_table
WHERE date_is_in_week_of(my_date_field, curdate()) = 1
SELECT Field1, Field2
FROM my_table
WHERE my_date_field BETWEEN date_sub(curdate(), interval weekday(curdate()) day)
AND date_add(curdate(), interval 6-weekday(curdate()) day)
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html