Hello there,
I need to do the following: At the moment I'm retrieving order details (name, item and price) from a MySQL database and outputting them into a webpage, which is quite big as the table has about 60-70 rows.
All I want to do is, instead of having a single huge table with 60-70 rows, to have the results in tables of 8, so each table would only have a maximum of 8 rows, and for example if there are 48 rows in the DB, 6 tables will be displayed on the web page with 8 rows each.
My current code looks like the following:
<tr>
<Td bgcolor="#e8e8e8">Name</td>
<td bgcolor="#e8e8e8">Item</td>
<td bgcolor="#e8e8e8">Total</td>
</tr>
<?php
$link = mysql_pconnect("localhost", "username", "password")
or die ("Could not connect");
mysql_select_db ("db")
or die ("Could not select database");
$query = "SELECT * FROM table ORDER BY date ASC";
$result = mysql_query ($query) or die ("Somethings really wrong in getwhere. " . $answer . "/ " . $default . "/ " . $table . "/ " . $select);
while ($results = mysql_fetch_array($result)) {
?>
<tr>
<Td bgcolor="#e8e8e8"><?php echo $results["first_name"]; ?> <?php echo $results["last_name"]; ?></td>
<td bgcolor="#e8e8e8"><?php echo $results["item_name"]; ?></td>
<td bgcolor="#e8e8e8">£<?php echo $results["total"]; ?></td>
</tr>
<?php } ?>
Thank you for all of your help, I'm in quite a rush and your help is much appreciated.