<?php
$koneksi = mysqli_connect('mysql.idhostinger.com','root','pw','db');
$result = mysqli_query($koneksi,'select * from posting');
while($row = mysqli_fetch_row($result)) {
for($x = 0; $x <= count($row); $x++) {
echo "<div style='background:green'>$row[$x]</div>";
}
}
?>
Hello guys! This code takes data from mysql, then prints it in a div container, wrapped with a div too.
The problem is that every row of data captured produces 2 div.
How to get each row to produce only and only 1 div?
Thank you.