<?php
	include('/var/www/html/uclit/protected/common/login/check.php');
	include('/var/www/html/uclit/protected/common/css_login/css_head2.php');
	include('/var/www/html/uclit/protected/connections/db_equip.php');

	$db = mysql_select_db('equipment', $equipConn) or die ("Unable to select equipment database.");			
			
	$sql_puters = "SELECT computers.workstation_id AS wid, computers.computer_serial AS cserial, 
		   		   	computers.computer_uc_property_num AS ucid, computers.computer_type AS ctype, 
		   			computers.cpu_type_speed AS cpu, computers.ram, computers.hd_capacity AS hdd 
		   		   FROM computers ORDER BY wid, cserial";
		   
	$sql_result = mysql_query($sql_puters, $equipConn) or die ("Unable to exercute query.<p>$sql_puters</p>");
	
	//Generate table column and column data
	echo "<h2>List of All Computers</h2>
		    <table border='1'>
		   	  <tr>
			    <td><strong>Workstation ID</strong></td>
			    <td><strong>PC Serial</strong></td>
				<td><strong>UC Property #</strong></td>
				<td><strong>PC Make-Model</strong></td>
				<td><strong>CPU Type/Speed</strong></td>
				<td><strong>Memory</strong></td>
				<td><strong>HDD Size</strong></td>
				<td><strong>View</strong></td>
				<td><strong>Edit</strong></td>
				<td><strong>Delete</strong></td>
			  </tr>";
	
	while($row = mysql_fetch_array($sql_result))
	{
		$wid = $row['wid'];
		$cserial = $row['cserial'];
		$ucid = $row['ucid'];
		$ctype = $row['ctype'];
		$cpu = $row['cpu'];
		$ram = $row['ram'];
		$hdd = $row['hdd'];
			
		echo "<tr>
		   	    <td>$wid</td>
		   		<td>$cserial</td>
		   		<td>$ucid</td>
		   		<td>$ctype</td>
		   		<td>$cpu</td>
		   		<td>$ram</td>
		   		<td>$hdd</td>
		   		<td align='center'><a href='http://ul.uc.edu/uclit/protected/itstaff/show_pcspecs.php?computer_serial=$cserial'><img src='./../../images/view.gif' alt='Detail View' border='0'></a></td>
		   		<td align='center'><a href='http://ul.uc.edu/uclit/protected/itstaff/show_addcomputer.php?computer_serial=$cserial&uaction=edit'><img src='./../../images/edit.gif' alt='Modify' border='0'></a></td>
		   		<td align='center'><a href='http://ul.uc.edu/uclit/protected/itstaff/show_addcomputer.php?computer_serial=$cserial&uaction=delete'><img src='./../../images/delete.gif' alt='Delete' border='0'></a></td>
		  	  </tr>";
	}
		
	echo "</table>";
	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); 
?>