<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>ReadSaleItemItemView PHP Page</title>
		<style type="text/css">
			h1 {text-align: center; color: blue}
			h2 {font-family: Ariel, sans-serif; text-align: left; color: blue}
			p.footer {text-align: center}
			table.output {font-family: Ariel, sans-serif}
		</style>
	</head>
	<body>
	<?php
		// Get connection
		$Conn = odbc_connect('QACS', 'QACS-User','QACS-User+password');
	
		// Test connection
		if (!Conn)
	    	{
	        	exit ("ODBC Connection Failed: " . $Conn);
	    	}
		// Create SQL statement
    	$SQL = "SELECT * FROM SaleItemItemView";
 
    	// Execute SQL statement
    	$RecordSet = odbc_exec($Conn,$SQL);
    
    	// Test existence of recordset
    	if (!$RecordSet)
	    	{
	        	exit ("SQL Statement Error: " . $SQL);
	    	}
	?>
	    <!--  Page Headers -->
	    <h1>
	   		The Queen Anne Curiosity Shop Sale_Item_Item_View
	   		<br />
	   		(Appendix E: SaleItemItemView)
		</h1>
	    <hr />
	    <h2>
	        SaleItemItemView
		</h2>
	<?php	  
		// Table headers
	    echo "<table class='output' border='1'>
	    		<tr>
	    			<th>SaleID</th>
	    			<th>SaleItemID</th>
	    			<th>ItemID</th>
	    			<th>SaleDate</th>
	    			<th>ItemDescription</th>
	    			<th>ItemCost</th>
	    			<th>ListItemPrice</th>
	    			<th>ActualItemPrice</th>
	    		</tr>";
	    
	    // Table data
	    while($RecordSetRow = odbc_fetch_array($RecordSet))
	    	{
	    	echo "<tr>";
	    	echo "<td>" . $RecordSetRow['SaleID'] . "</td>";
	    	echo "<td>" . $RecordSetRow['SaleItemID'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ItemID'] . "</td>";
	    	echo "<td>" . $RecordSetRow['SaleDate'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ItemDescription'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ItemCost'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ListItemPrice'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ActualItemPrice'] . "</td>";
	    	echo "</tr>";
	    	}
	    echo "</table>";
	    
	    // Close connection
	    odbc_close($Conn);
	?>
		<br />
		<hr />
		<p class="footer">
			<a href="../QACS/index.html">Return to The Queen Anne Curiosity Shop Home Page</a>
		</p>
		<hr />
    </body>
</html>