current scenario is as follows, I have my query to send an email regardless of time to be sent 48hrs before a booking is made. However my problem is that this email needs to be sent out if the booking is within 48hr timeframe of when purchased then the email should be sent straight away as well as the confirmation email etc. Here is the sql query as it stands
session_start();
global $wpdb;
$start_time = strtotime('+48 hours');
$end_time = strtotime('+50 hours');
///running Schedule to send out 48hrs before purchased ride
$hours_48 = $wpdb->get_results("SELECT id, order_id, vehicle_name, start_date_time FROM fcb_booking WHERE status='paid' AND notified_48_hour=0 AND start_date_time > " . $start_time . " AND start_date_time < " . $end_time . " GROUP BY order_id ORDER BY start_date_time DESC");
Not sure how to add that if the time is within 48hrs of actual ride pickup time then send the email regardless but keep current functionality.