this is my code
$sql = "SELECT * FROM `sale_history` WHERE `date` BETWEEN :fromdate AND :todate";
$stmt = $PDO->prepare($sql);
$stmt->bindParam(':fromdate', $_POST['fromdate'], PDO::PARAM_STR);
$stmt->bindParam(':todate', $_POST['todate'], PDO::PARAM_STR);
$stmt->execute();
$total = $stmt->rowCount();
while ($row = $stmt->fetchObject()) {
echo "$row->date";
echo "$row->product";
echo "$row->username";
echo "$row->quantity";
}
but its not working, where is the mistake i did?