my english is very bad and I am getting confused here, can someone help me?
My PHP:
<?php require("db.php"); ?>
<?php //Select All Orders
$stmt = $db->prepare("SELECT * FROM `users`");
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$counter++;
if($counter % 2 == 0) {
echo "<div class='ui stackable six cards'>";
echo $one[] = "<div class='ui card small'><div class='image'><img src='".$row["avatar"]."'></div>";
echo $two[] = "<div class='content'><a class='header'>Dias".$row["username"]."</a></div></div>";
echo "</div>";
}
}
}
$stmt->close();
?>
So what I want to do is for every 2 rows I want to split.
So it would look like so:
<div class="ui stackable six cards">
<div class="ui card small">
<div class="image">
<img src="assets/img/players/dias.jpg">
</div>
<div class="content">
<a class="header">Dias</a>
</div>
</div>
<div class="ui card small">
<div class="image">
<img src="assets/img/players/dias.jpg">
</div>
<div class="content">
<a class="header">Dias</a>
</div>
</div>
And what seperates them is the "<div class="ui stackable six cards">
" as well as the "</div>
"
How exactly do I make it split every 2 rows using my PHP code? I cannot figure it out
So for every 2 rows that it finds in the database it needs to echo "<div class="ui stackable six cards">
" and "</div>
" at the end.
IS THIS IMPOSSIBLE? IT SEEMS SO