Bootstrap’s cards and php data-ThrowExceptions

Exception or error:

i use Bootstrap’s cards and php but i don’t want to show a card per line

screen 1

i want to show Bootstrap’s card two per line like this:

screen 2

what can i do ?

this is my code:

<?php 
                    $no_pharmacies_par_page = 5;
                    if (isset($_GET['page']))
                    {
                      $page = $_GET['page'];
                    }
                    else
                    {
                      $page = 1;
                    }
                    $ph = $no_pharmacies_par_page * $page - $no_pharmacies_par_page;
                    $sql_select_pharma = "SELECT * FROM pharmacies WHERE pharmacie_garde = 1 ORDER BY id desc LIMIT {$ph} ,{$no_pharmacies_par_page} ";
                    $res_sql_select_pharma = mysqli_query($dbconnection, $sql_select_pharma);
                    while ($rowpharma = mysqli_fetch_assoc($res_sql_select_pharma))
                    {
                      $id_pharma = $rowpharma['id'];
                      $nom_pharma = $rowpharma['nom_pharma'];
                      $pharma_syndicat = $rowpharma['nom_syndicat'];
                      $date_debut = $rowpharma['date_deb'];
                      $pharma_modif_date = $rowpharma['date_fin'];
                      $image_pharmacie = $rowpharma['image_pharmacie'];
                      $adresse_pharmacie = $rowpharma['adresse_pharma'];
                      $tel_pharmacie = $rowpharma['tel_pharmacie'];
                      $pharma_garde = $rowpharma['pharmacie_garde'];
                      $email_pharmacie = $rowpharma['email_pharmacie'];
                 ?>

                 <div class="card-deck">
                    <div class="card">
                      <img class="card-img-top" src="admin/images/pharmacides/<?php  echo $image_pharmacie; ?>" alt="Card image cap">
                      <div class="card-body">
                        <h5 class="card-title"><?php echo $nom_pharma; ?></h5>
                        <p class="card-text"><?php  echo substr($adresse_pharmacie, 0, 80) . "...";?></p>
                      </div>
                      <div class="card-footer">
                        <small class="text-muted"><?php echo $date_debut; ?></small>
                      </div>
                    </div>

                  </div>

          <?php } ?>
How to solve:

Replace your html code with this and it’ll do the required job.

<div class="container">
    <div class="row">
        <!-- Put Your For loop here to loop through your data -->
        <div class="col-6">
            <div class="card-deck">
                <div class="card">
                    <img class="card-img-top" src="admin/images/pharmacides/<?php  echo $image_pharmacie; ?>" alt="Card image cap">
                    <div class="card-body">
                        <h5 class="card-title"><?php echo $nom_pharma; ?></h5>
                        <p class="card-text"><?php  echo substr($adresse_pharmacie, 0, 80) . "...";?></p>
                    </div>
                    <div class="card-footer">
                        <small class="text-muted"><?php echo $date_debut; ?></small>
                    </div>
                </div>
            </div>            
        </div>
    </div>
</div>

Leave a Reply

Your email address will not be published. Required fields are marked *