i want to filter data between two dates. i did coding but getting error. Trying to figure out the problem but couldn't . Please help me.
HERE IS THE CODE
<?php
$user='root';
$pass='';
$db='mypro_bms';
$conn = mysqli_connect('localhost',$user,$pass,$db);
if(isset($_POST['search'])){
$txtStartDate=$_POST["txtStartDate"];
$txtEndDate=$_POST["txtEndDate"];
$q=mysqli_query($conn,"SELECT blood_group, SUM(blood_bag) as sum FROM donate where donation_date BETWEEN '$txtStartDate' and '$txtEndDate' order by donation_date");
$count=mysqli_num_rows($q);
}
?>
<body>
<form method="post">
<input type="date" name="txtStartDate">
<input type="date" name="txtEndDate">
<input type="submit" name="search" value="search">
<?php
if ($count=="0")
{
echo "No data"; }
else
{
while ($row=mysqli_fetch_array($q)) {
echo"['".$row['blood_group']."',".$row['sum']."],";
}
}