I have a table called orders
with orderID
, StartDate
, EndDate
, etc.
I want to find if today's date falls within StartDate
and EndDate
. As a starting point I want to print the result that apply
This is my code I just cannot make it work. Also, CURDATE()
does not work for me.
<?php
//$originalDate = "2010-03-21";
//$newDate = date("d-m-Y", strtotime($originalDate));
include "dbh.php";
$today = DATE("Y-m-d");
// WHERE $today > StartDate OR $today < EndDate OR $today > SuspendEnd
OR $today < SuspendStart";
//{
// echo $today;
//}
$sql= "SELECT * FROM orders
WHERE $today = StartDate
";
$records = mysqli_query($conn,$sql);
while($row = mysqli_fetch_assoc($records)){
echo "<tr>";
echo "<td>".$row['OrderID']."</td>";
//echo "<td>".$row['StartDate']."</td>";
echo "</tr>";
}
?>