I have a mysql database with over a million records and need to see how many records exist between specific dates.
This is my code and always get one row.
I have validated that over the period in my code there are over 500 records.
What am I doing wrong?
$start_date = "1990-01-01";
$end_date = "1990-02-31";
echo "Start date is : " . $start_date . "<br>";
echo "End date is : " . $end_date . "<br>";
$sql = "SELECT COUNT(*) FROM " . $rgdtable . " WHERE `DATE-REGISTERED` BETWEEN " . $start_date . " AND " . $end_date;
echo "Sql string is : " . $sql . "<br>";
if ($result=mysqli_query($conn,$sql)) {
$rowcount=mysqli_num_rows($result);
echo "The total number of rows are: ".$rowcount;
}