Get all the results $index = 1;
Why $index not added 1 Although I wrote $index++; Before closing foreach?
$index = 1;
foreach ($months as $month) {
if( $index = '1' ){ ?>
   <div class="col-md-12">
     <div class="card border-info">
       <a href="vote.php?id=<?php echo $month['id']; ?>"><?php echo $month['month_name']; ?></a>
     </div>
   </div>
<?php }
elseif( $index = '2' || $index = '5' || $index = '8' || $index = '11' ){  ?>
   <div class="col-md-3">
     <div class="card border-primary">
       <a href="vote.php?id=<?php echo $month['id']; ?>"><?php echo $month['month_name']; ?></a>
     </div>
   </div>
<?php }
elseif( $index = '3' || $index = '6' || $index = '9' || $index = '12' ){  ?>
   <div class="col-md-3">
     <div class="card border-success">
       <a href="vote.php?id=<?php echo $month['id']; ?>"><?php echo $month['month_name']; ?></a>
     </div>
   </div>
<?php }
elseif( $index = 4 || $index = 7 || $index = 10 || $index = 13 ){  ?>
   <div class="col-md-3">
     <div class="card border-danger ">
       <a href="vote.php?id=<?php echo $month['id']; ?>"><?php echo $month['month_name']; ?></a>
     </div>
   </div>
<?php }
$index++;
}
 
     
    