I'm retrieving data from MySQL which I'm listing on a page with HTML. I need each three throws from MySQL to be placed in a separate div when I'm looping through them.
My current code works but it prints all of the rows in a single div.
<div class="flex">
<?php
$get_plans = $database->sql("SELECT * FROM plans", array(), 'count');
if ($get_plans != 0)
{
$get_plans = $database -> sql("SELECT * FROM plans", array(), 'rows');
foreach ($get_plans as $plan)
{
$id = $plan['id'];
$name = $plan['name'];
echo '
<div class="flex-33">
ID: '.$id.'
Name: '.$name.'
</div>
';
}
}
?>
</div>
I would like the generated HTML to look like this: http://prntscr.com/ogx2bu