I want to show a count of events month-wise. I am showing the upcoming months from current months and show the number of events month-wise.
Below is the whole code to show upcoming events month-wise.
<div class="row">
<?php for($i=0;$i<6;$i++) {
$query1 = mysqli_query($con,"select YEAR(start) AS year, MONTH(start) AS month, COUNT(DISTINCT start) AS joins from sys_events where start BETWEEN '2015-02-30' AND '2220-12-31' group by YEAR(start), MONTH(start)") or die(mysql_error());
$retreiveCount = mysqli_num_rows($query1);
?>
<div class=" col-sm-4 col-6 text-center mb-3 ">
<div class="cardd">
<a href="day-wise.php?dt=<?php echo date('m-Y', strtotime(' +'.$i.' month')) ; ?>">
<img src="images/jma-team-wide.jpg" class="img-fluid">
<div class="event-block">
<div class="date-box2"><?php echo date('F', strtotime(' +'.$i.' month')) ; ?></div>
<div class="contain-box" style="width:100%;"><div class="dd" style="padding:10px;font-size: 16px; line-height: 10px;text-align:center;color:#fff; font-weight:600;"> <?php echo $retreiveCount; ?> Events</div>
</div>
</div>
</a> </div>
</div>
<?php } ?>
</div>
Currently, October has 2 events but data is repeating in upcoming months as 2 events are repeating.