I'm trying to layout items in an xhtml page using CSS that I am getting from a MySQL database through a php connection. I am able to get the records into the page but I can't figure out how to lay them out. I want it to look like the following
| Item 1 | | Item 2 | | Item 3 |
| Item 4 | | Item 5 | | Item 6 |
| Item 7 | | Item 8 | | Item 9 |
after item 9 I want it to paginate. I was able to generate some code using Dreamweaver MX, but I want to figure out how to do it cleanly and simply. Here's the code I am currently working with.
<?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Product Listing Test</title>
<style type="text/css">
@import "../styles/footer.css";
</style>
</head>
<?php require_once('../../connections/watches.php'); ?>
<?php
$maxRows_watches = 9;
$pageNum_watches = 0;
if (isset($HTTP_GET_VARS['pageNum_watches'])) {
$pageNum_watches = $HTTP_GET_VARS['pageNum_watches'];
}
$startRow_watches = $pageNum_watches * $maxRows_watches;
mysql_select_db($database_watches, $watches);
$query_watches = "SELECT title, description FROM watches ORDER BY gs_price DESC";
$query_limit_watches = sprintf("%s LIMIT %d, %d", $query_watches, $startRow_watches, $maxRows_watches);
$watches = mysql_query($query_limit_watches, $watches) or die(mysql_error());
$row_watches = mysql_fetch_assoc($watches);
if (isset($HTTP_GET_VARS['totalRows_watches'])) {
$totalRows_watches = $HTTP_GET_VARS['totalRows_watches'];
} else {
$all_watches = mysql_query($query_watches);
$totalRows_watches = mysql_num_rows($all_watches);
}
$totalPages_watches = ceil($totalRows_watches/$maxRows_watches)-1;
?>
<body>
<?php do { ?>
<div class="footer_column">
<p><?php echo $row_watches['title']; ?></p>
<p><?php echo $row_watches['description']; ?></p>
</div>
<?php } while ($row_watches = mysql_fetch_assoc($watches)); ?>
</body>
</html>
<?php mysql_free_result($watches); ?>
FYI the "footer_column" in the linked style sheet looks like this:
.footer_column
{
float: left;
padding: 0px;
margin-left: 7px;
margin-top: 0px;
margin-right: 7px;
width: 105px;
height: 115px;
text-align: left;
}
Anyone know how to take care of this, right now, there are only 4 records in the table and it is displaying all the items horizontally?