Skip to content

Instantly share code, notes, and snippets.

@Moketronics
Created February 25, 2012 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Moketronics/1911477 to your computer and use it in GitHub Desktop.
Save Moketronics/1911477 to your computer and use it in GitHub Desktop.
Inventory page currently printing all information to simple table
<?php
$sPage_title = 'Full Inventory';
include ('./includes/header.html');
require_once('../../../mysql_connect.php');
?>
<table>
<tr>
<th>Tile ID:</th>
<th>Tile name:</th>
<th>Price:</th>
<th>Quantity:</th>
<th>Old Lot:</th>
<th>Height</th>
<th>Width</th>
<th>Thick:</th>
<th>Height (mm):</th>
<th>Width (mm):</th>
<th>Box Count:</th>
<th>Local Supply:</th>
<th>Rating:</th>
<th>Material:</th>
<th>Primary Colour:</th>
<th>Secondary Colours:</th>
<th>Manufacturer:</th>
<th>Country:</th>
</tr>
<?php
$query = "SELECT ti.tile_id,
ti.tile_name,
ti.tile_price,
ti.quantity,
ti.old_lot_qty,
ti.nom_height,
ti.nom_width,
ti.nom_thick,
ti.exact_height,
ti.exact_width,
ti.box_tile_count,
ti.local_supply,
ti.rating,
mat.material_name,
con.country_name,
man.manufacturer_name,
col.colour_name
FROM tiles AS ti,
material AS mat,
material_associations AS mat_ass,
country AS con,
country_associations AS con_ass,
manufacturer AS man,
manufacturer_associations AS man_ass,
colour AS col,
colour_associations AS col_ass
WHERE ti.tile_id=mat_ass.tile_id AND mat.material_id=mat_ass.material_id
AND ti.tile_id=con_ass.tile_id AND con.country_id=con_ass.country_id
AND ti.tile_id=man_ass.tile_id AND man.manufacturer_id=man_ass.manufacturer_id
AND (ti.tile_id=col_ass.tile_id AND col.colour_id=col_ass.colour_id AND col_ass.b_primary_colour='1');";
$result = @mysql_query($query);
if ($result) {
while ($row = mysql_fetch_array($result)) {
echo "\t<tr>\n\t\t<td>" . $row['tile_id'] . "</td>\n";
echo "\t\t<td>" . $row['tile_name'] . "</td>\n";
echo "\t\t<td>" . $row['tile_price'] . "</td>\n";
echo "\t\t<td>" . $row['quantity'] . "</td>\n";
echo "\t\t<td>" . $row['old_lot_qty'] . "</td>\n";
echo "\t\t<td>" . $row['nom_height'] . "</td>\n";
echo "\t\t<td>" . $row['nom_width'] . "</td>\n";
echo "\t\t<td>" . $row['nom_thick'] . "</td>\n";
echo "\t\t<td>" . $row['exact_height'] . "</td>\n";
echo "\t\t<td>" . $row['exact_width'] . "</td>\n";
echo "\t\t<td>" . $row['box_tile_count'] . "</td>\n";
echo "\t\t<td>" . $row['local_supply'] . "</td>\n";
echo "\t\t<td>" . $row['rating'] . "</td>\n";
echo "\t\t<td>" . $row['material_name'] . "</td>\n";
echo "\t\t<td>" . $row['colour_name'] . "</td>\n";
echo "\t\t<td>n/a</td>\n";
echo "\t\t<td>" . $row['manufacturer_name'] . "</td>\n";
echo "\t\t<td>" . $row['country_name'] . "</td>\n\t</tr>\n";
}
}
echo '</table>';
mysql_close(); // Done everything!
?>
<h1 id="mainhead">Stuff for this page</h1>
<p>Not sure exactly what will separate this from just making a blank search.</p>
<p>The general idea will be to make it easy to scan for the most important information points. Maybe it will also include a bunch of statistics on the entire inventory.</p>
<?php
include ('./includes/footer.html');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment