<?php

$db_name = "thebookb_tbb";

$table_name = "products";

$connection = mysql_connect ("server", "userid", "password") or die ('I cannot connect to the database because: ' . mysql_error());

// get the database list

$dbs = mysql_select_db ($db_name, $connection) or die(mysql_error());

$sql = "SELECT products_model FROM $table_name ORDER BY products_id";

$results = mysql_query($sql, $connection) or die(mysql_error());

// read the database

$display_table .= "<tr>";
$count = 1;
while ($row = mysql_fetch_array($results)) {

$product_name = $row[products_model];

$display_table .= "

<td width=\"1\" bgcolor=\"gray\"></td>
<td width=\"40\"><input name=\"col1_qty\" size=\"3\" maxlength=\"3\" /></td>
<td width=\"145\">$product_name<input type=\"hidden\" name=\"product_descr\" value=\"product_descr\"></td>
<td width=\"40\">______</td> ";

If ($count >= 3){
$display_table .= "<td width=\"1\" bgcolor=\"gray\"></td></td></tr>";
$count = 1;}
else {
$count = $count +1;}

}


// begin display table

$start_form = "<form method=\"post\" action=\"process_orderform.php\">\n";

$end_form = "</form>\n";

$start_table = "<table border=\"0\">\n";

$table_header = "<table width=\"*\" cellspacing=\"0\" cellpadding=\"1\"border=\"0\">
<tr>
<td width=\"1\" bgcolor=\"gray\"></td>

<td width=\"40\">Qty</td>
<td width=\"145\">Item</td>
<td width=\"40\">Price</td>

<td width=\"1\" bgcolor=\"gray\"></td>

<td width=\"40\">Qty</td>
<td width=\"145\">Item</td>
<td width=\"40\">Price</td>

<td width=\"1\" bgcolor=\"gray\"></td>

<td width=\"40\">Qty</td>
<td width=\"145\">Item</td>
<td width=\"40\">Price</td>

<td width=\"1\" bgcolor=\"gray\"></td>
</tr>" ;
$end_table = "</table>\n";

mysql_close($connection);

?>