Guest Posted September 8, 2020 Share Posted September 8, 2020 <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 Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/ Share on other sites More sharing options...
gw1500se Posted September 8, 2020 Share Posted September 8, 2020 Cards are formatted with CSS so this is not really a PHP question. Perhaps this example is what you are looking for. Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581232 Share on other sites More sharing options...
Guest Posted September 8, 2020 Share Posted September 8, 2020 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 Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581238 Share on other sites More sharing options...
Guest Posted September 14, 2020 Share Posted September 14, 2020 ? Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581366 Share on other sites More sharing options...
Barand Posted September 14, 2020 Share Posted September 14, 2020 Instead of outputting the the HTML for a table with rows, you output the HTML for the cards instead. Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581380 Share on other sites More sharing options...
Guest Posted September 17, 2020 Share Posted September 17, 2020 but as I have already tried it but it did not work out right Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581449 Share on other sites More sharing options...
gizmola Posted September 18, 2020 Share Posted September 18, 2020 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 Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581462 Share on other sites More sharing options...
ScoobyDont Posted September 18, 2020 Share Posted September 18, 2020 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 Quote Link to comment https://forums.phpfreaks.com/topic/311446-help-with-cards-instead-of-tables/#findComment-1581469 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.