<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
    <head>
	<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
        <title>ReadViewCustomerContacts 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('WM', '', '');

	// Test connection
	if (!$Conn)
            {
	       	exit ("ODBC Connection Failed: " . $Conn);
	    }
	// Create SQL statement
    	$SQL = "SELECT * FROM viewCustomerContacts";
 
    	// Execute SQL statement
    	$RecordSet = odbc_exec($Conn,$SQL);
    
    	// Test existence of recordset
    	if (!$RecordSet)
            {
	       	exit ("SQL Statement Error: " . $SQL);
	    }
    ?>
	<!--  Page Headers -->
        <h1>
            The Wallingford Motors CRM Customer Contacts List
	</h1>
	<hr />
	<h2>
	    viewCustomerContacts
	</h2>
	<?php	  
		// Table headers
	    echo "<table class='output' border='1'>
	    		<tr>
	    			<th>ContactID</th>
	    			<th>LastName</th>
	    			<th>FirstName</th>
	    			<th>ContactDate</th>
	    			<th>NickName</th>
	    			<th>ContactType</th>
	    			<th>Remarks</th>
	    		</tr>";
	    
	    // Table data
	    while($RecordSetRow = odbc_fetch_array($RecordSet))
	    	{
	    	echo "<tr>";
	    	echo "<td>" . $RecordSetRow['ContactID'] . "</td>";
	    	echo "<td>" . $RecordSetRow['LastName'] . "</td>";
	    	echo "<td>" . $RecordSetRow['FirstName'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ContactDate'] . "</td>";
	    	echo "<td>" . $RecordSetRow['NickName'] . "</td>";
	    	echo "<td>" . $RecordSetRow['ContactType'] . "</td>";
	    	echo "<td>" . $RecordSetRow['Remarks'] . "</td>";
	    	echo "</tr>";
	    	}
	    echo "</table>";
	    
	    // Close connection
	    odbc_close($Conn);
	?>
		<br />
		<hr />
		<p class="footer">
			<a href="../WM/index.html">Return to Wallingford Motors Home Page</a>
		</p>
		<hr />
    </body>
</html>