Jump to content

Help with cards instead of tables


Guest

Recommended Posts

 <section class="no-padding-top">
                <div class="col-lg-12">
                    <div class="block margin-bottom-sm">
                        <div class="table-responsive"> 
                            <table class="table">
                                <thead>
                                    <tr>
                                    <th scope="col">User</th>
                                    <th scope="col">Datum</th>
                                    <th scope="col"><a class="btn btn-primary" href="convoy_user.php?id=<?php echo $result['id']; ?>&action=part" role="button">Teilnehmen</a></th>
                                    </tr>
                                </thead>
                            <tbody>
                        <tr>
                        <?php
                            $query = 'SELECT * FROM convoy_part WHERE user_convoy= :I';
                            $start = $bdd->prepare($query);
                            $start->execute(array(':I' => $_GET['id']));
                            $rows = $start->fetchAll(PDO::FETCH_ASSOC);
                            foreach ($rows as $row) {
                                
                             
                            
                            echo "<tr>";
                            echo "<td>" . $row['name'] . "</td>";
                            echo "<td>" . $row['date'] . "</td>";
                            echo "</tr>";
                          
                             } ?>
                        </tr>
                  </tbody>
                </table>
           </section>

 

hello how can i do this in single cards instead of a table

Link to comment
Share on other sites

1 hour ago, gw1500se said:

Cards are formatted with CSS so this is not really a PHP question. Perhaps this example is what you are looking for.

 

how i design a card i know but how i implemented it now that it is no longer a table but a card i can't imagine

Link to comment
Share on other sites

Something like this should work

 

<?php foreach $rows as $row) : ?>
    <div class="card">
      <h4 class="card-title">Card Title</h4>
      <p class="card-text"> 
            User: <?php echo $row['name']; ?>
      <br>
            Date: <?php echo $row['date']; ?>
     </p>
    </div>
  <?php endforeach; ?>

Obviously you need to style the card as you see fit

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.