Certainly.
I've added some comments that may help too.
PHP Code:
<?php
# get 20 items from the database
$sql = 'SELECT * FROM items ORDER BY prodtitle ASC LIMIT 20;';
# execute the query
$res = mysql_query($sql);
# create an array to store the 20 items
$items = array();
# loop through the items from the database
while($item = mysql_fetch_assoc($res)){
# save the item to our array
array_push($items, $item);
}
?>
<html>
<head>
<title>Deom</title>
</head>
<body>
<div id="products">
<?php foreach(array_chunk($items, 10) as $item_list): ?>
<div class="list">
<?php foreach($item_list as $item): ?>
<?php echo $item['prodtitle']; ?>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
</body>
</html>
Bookmarks