Jump to content

Help with cards instead of tables


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
https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/
Share on other sites

18 hours ago, Endrick said:

but as I have already tried it but it did not work out right

The html generated along with the css you used, would allow people to help you diagnose what is or isn't working.  Also, you would still need tables, or alternatively convert to flexbox or css grid

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

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.