<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>ReadPurchaseItemItemView 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('JRJ', 'JRJ-User','JRJ-User+password');
	
		// Test connection
		if (!Conn)
	    	{
	        	exit ("ODBC Connection Failed: " . $Conn);
	    	}
		// Create SQL statement
    	$SQL = "SELECT * FROM PurchaseItemItemView";
 
    	// Execute SQL statement
    	$RecordSet = odbc_exec($Conn,$SQL);
    
    	// Test existence of recordset
    	if (!$RecordSet)
	    	{
	        	exit ("SQL Statement Error: " . $SQL);
	    	}
	?>
	    <!--  Page Headers -->
	    <h1>
	   		The James River Jewelry Purchase_Item_Item_View
	   		<br />
	   		(Appendix E: PurchaseItemItemView)
		</h1>
	    <hr />
	    <h2>
	        PurchaseItemItemView
		</h2>
	<?php	  
		// Table headers
	    echo "<table class='output' border='1'>
	    		<tr>
	    			<th>InvoiceNumber</th>
	    			<th>ItemNumber</th>
	    			<th>ArtistLastName</th>
	    			<th>ArtistFirstName</th>
                                <th>ItemDescription</th>
                                <th>Cost</th>
	    			<th>RetailPrice</th>
	    		</tr>";
	    
	    // Table data
	    while($RecordSetRow = odbc_fetch_array($RecordSet))
	    	{
	    	echo "<tr>";
	    	echo "<td>" . $RecordSetRow['InvoiceNumber'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ItemNumber'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ArtistLastName'] . "</td>";
                echo "<td>" . $RecordSetRow['ArtistFirstName'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ItemDescription'] . "</td>";
                echo "<td>" . $RecordSetRow['Cost'] . "</td>";
	    	echo "<td>" . $RecordSetRow['RetailPrice'] . "</td>";
	    	echo "</tr>";
	    	}
	    echo "</table>";
	    
	    // Close connection
	    odbc_close($Conn);
	?>
		<br />
		<hr />
		<p class="footer">
			<a href="../JRJ/index.html">Return to James River Jewelry Home Page</a>
		</p>
		<hr />
    </body>
</html>