0

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    You have an error. [`mysql_error()`](https://www.php.net/manual/en/function.mysql-error.php) worked only for the old API. Please consider switching error mode on instead. [How to get the error message in MySQLi?](https://stackoverflow.com/a/22662582/1839439) – Dharman Oct 15 '20 at 16:42
  • thanx but still i get the same issue...please help me with solution – Faizan Ullah Khan Oct 16 '20 at 06:29

0 Answers0