SHARE
TWEET

Untitled

a guest Aug 13th, 2017 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sql = 'SELECT *, (CASE WHEN `from` BETWEEN DATE_SUB(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL 4 HOUR) AND DATE_ADD(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL "1 4" DAY_HOUR) THEN `from`
  2.                                         WHEN `to` BETWEEN DATE_SUB(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL 4 HOUR) AND DATE_ADD(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL "1 4" DAY_HOUR) THEN `to`
  3.                                     END) AS ttime
  4.                                     FROM `bookings` WHERE `from` BETWEEN DATE_SUB(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL 4 HOUR) AND DATE_ADD(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL "1 4" DAY_HOUR) OR `to` BETWEEN DATE_SUB(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL 4 HOUR) AND DATE_ADD(STR_TO_DATE("'.$date.'", "%Y-%m-%d"), INTERVAL "1 4" DAY_HOUR) AND `status`!="cancelled" ORDER BY ttime';
RAW Paste Data
Top