Is it possible to generate divs using javascript from database?
You need AJAX for the same. So you need to make the PHP script output:
<?php
$conn = mysqli_connect($host, $user, $pass, $data);
$res = mysqli_query($conn, "SELECT * FROM `table`");
while (false != ($dat = mysqli_fetch_array($res)) {
echo '<li>' . $dat[0] . '</li>';
}
?>
And in your HTML, using jQuery, you can do this:
$("#list").load("db.php");
And your HTML should be:
<ul id="list">
<li>Loading data...</li>
</ul>