I have a query that needs to return records where the ShipDate is between a range of dates. The following query works:
$query = "SELECT ECCustomerOrder.ShipDate,
ECCustomers.Customer,
ECCustomerOrder.PO,
ECCustomerOrder.TotalCases,
ECCustomerOrder.order_number
FROM ECCustomerOrder INNER JOIN ECCustomers ON ECCustomerOrder.ID = ECCustomers.ID
WHERE ECCustomerOrder.ShipDate >= $todayMinus";
$todayMinus is a php variable set earlier in the script that takes the current date and subtracts 15 days. What I can't get to work is the following:
$query = "SELECT ECCustomerOrder.ShipDate,
ECCustomers.Customer,
ECCustomerOrder.PO,
ECCustomerOrder.TotalCases,
ECCustomerOrder.order_number
FROM ECCustomerOrder INNER JOIN ECCustomers ON ECCustomerOrder.ID = ECCustomers.ID
WHERE ECCustomerOrder.ShipDate BETWEEN $todayMinus AND $todayPlus";
What is the proper syntax for this SQL query to return the records between the ShipDates of $todayMinus and $todayPlus?