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">
                                    <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>
                            $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>";
                             } ?>


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

Link to post
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 post
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

Link to post
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']; ?>
            Date: <?php echo $row['date']; ?>
  <?php endforeach; ?>

Obviously you need to style the card as you see fit

Link to post
Share on other sites

Join the conversation

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

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.