Table 1 - style_img. Contains the style numbers and images.
Table 2 - products. Contains all information about each style, size, style no., sku, etc.
My objective is to create an ordering page for each style. Each style is available in 9 or 10 sizes and 28 - 32 colors. I have been attempting to code for 1 cell of a table, then use a for or foreach to loop through all the colors/sizes to display one color with corresponding sizes in each cell. I then wanted to apply pagination to display 3 cells across the page; 4 or 5 rows on each page.
The linked page is a sample I created by using only one color in my code so I could better explain what I am attempting.
http://www.testsite.uniqueuniforms.com/testWW.php
Here is the php code I have (without the foreach):
Code: Select all
include('admin/misc.inc');
$cxn = mysqli_connect($host,$user,$passwd,$dbname) or die ("couldn't connect to server" . mysqli_error());
$input = "input type=\"text\" size=\"2\" name=";
$colors = array('Black', 'Celadon', 'Chocolate', 'Ciel');
echo "<table width:750px cellpadding='0' cellspacing='0'>";
echo "<tr>";
$result = mysqli_query($cxn,"SELECT * FROM style_img WHERE style_no='4112'")or die ("problem with query" . mysqli_error());
while($row = mysqli_fetch_assoc($result))
{
echo "<td width='250'>";
echo "<img src='../images/{$row['photo_sm']}' border='0' align='left'>";
echo "</p>";
}
$result2= mysqli_query($cxn,"SELECT * FROM products WHERE style_no='4112' ORDER BY size_rank") or die ("problem with second query" . mysqli_error());
while($row = mysqli_fetch_array($result2))
{
echo "<p><font face='Arial Narrow' size='2'><$input\"{$row['price']}_{$row['sku']} {$row['vendor_name']} {$row['color_name']} {$row['desc']} #{$row['style_no']}-{$row['color_code']}-{$row['size']}(nontaxable)_{$row['shipping']}\"> {$row['size']}@ \${$row['price']} each</p>";
}
echo "</td>";
echo "</tr>";
echo "</table>";