Location: PHPKode > projects > Gsys > php/tshirt_orders.php
<?PHP
//Filename : tshirt_orders.php
//Description : Display all tshirt orders
//Author :  Marty
//Last modified :  2006.12.20

    include '../includes/auth.php';
    include '../includes/db.php';
	include '../includes/vars.php';

	$sql = 'SELECT brothers . l_name , brothers . f_name , tshirts . title , tshirt_orders . quantity , tshirt_orders . size , tshirt_orders . total FROM (tshirt_orders INNER JOIN brothers ON brothers . pin_num = tshirt_orders . pin_num) INNER JOIN tshirts ON tshirts . design_id = tshirt_orders . design_id WHERE tshirt_orders . quantity > 0 ORDER BY tshirt_orders . size';
	$result = mysql_query($sql,$connection) or die(mysql_error());

    $counter = 1; //setup row counter
	$title = "T-Shirt Orders";

	$sql2 = 'SELECT size, COUNT(size) FROM tshirt_orders GROUP BY size';
	$result2 = mysql_query($sql2, $connection) or die(mysql_error());
	
	
	$sql3 = 'SELECT SUM(total) FROM tshirt_orders';
	$result3 = mysql_query($sql3, $connection) or die(mysql_error());
	$total_array = mysql_fetch_array($result3);
	$order_total = $total_array['SUM(total)'];
?>

<html>
<head><title><?php echo "".$chapter. " :: ".$title." :: " .$school.""; ?> </title>
<link href="../includes/index.css" rel="stylesheet" type="text/css">
</head>

<body class="body">
<center><h2>Current T-Shirt Orders  ||  Generated <?php echo date("F j, Y, g:i a"); ?></h2></center>
<br><br>
<p><a class="body" href="/php/brother_home.php">Return to Brother Home</a></p>
<br><br>
<table width="10%" border="0" cellpadding="0" align="center">
<tr>
<td><strong>Size</strong></td>
<td><strong><center>Quantity</center></strong></td>
</tr>
<?php
//Loop through the results
    while ($row = mysql_fetch_array($result2))
    {
        $size = $row['size'];
        $qty = $row['COUNT(size)'];

?>

<tr>
<td><?php echo($size);?></td>
<td><center><?php echo($qty);?></center></td>

</tr>


<?php
    } //close loop
?>
<tr><td></td><td></td></tr>
<tr>
<td>Total Price:</td>
<td><center><font color="red">$<?php echo $order_total;?>.00</font></center></td>
<tr>
</table><p>
<!-- Setup table to display data -->
<table width="100%" border="0" cellpadding="0">
<tr>
<td width="3%"></td>
<td><strong>Last Name</strong></td>
<td><strong>First Name</strong></td>
<td><strong>Shirt Design</strong></td>
<td><strong>Quantity</strong></td>
<td><strong>Size</strong></td>
<td><strong><center>Amt. Charged</center></strong></td>
</tr>

<?php
//Loop through the results
    while ($row = mysql_fetch_array($result))
    {
        $l_name = $row['l_name'];
        $f_name = $row['f_name'];
        $design_title = $row['title'];
		$quantity = $row['quantity'];
		$size = $row['size'];
		$total = $row['total'];
?>

<tr>
<td><?php echo($counter); $counter++; ?></td>
<td><?php echo($l_name);?></td>
<td><?php echo($f_name);?></td>
<td><?php echo($design_title);?></td>
<td><?php echo($quantity);?></td>
<td><?php echo($size);?></td>
<td><center><font color="red"><?php echo($total);?></font></center></td>

</tr>

<?php
    } //close loop
?>
</table>


<p><a href="/php/brother_home.php">Return to Brother Home</a></p>
</body>
</html>
Return current item: Gsys