<?php
session_start();

include "../functions.php";
checkAdmin(session_id());

include "header.php";

?>

<center>

<table width="80%" border="0" cellpadding=5 cellspacing=1>
<th>Press Name</th>
<th>Press Description</th>
<th colspan="2">Options</th>

<?php
$query = "select * from media_media";

$result = mysql_query($query) or die (mysql_error());

	
while ($row = mysql_fetch_array($result))
{
	if ($lastColor == 1) 
	{
		$lastColor = 0;
	} 
	else 
	{
		$lastColor = 1;
	}

	altBG($lastColor);
	
	$mediaID = $row[0];
	$categoryID = $row[1];
	$mediaName = $row[2];
	$mediaDescrip = $row[3];
	$mediaURL = $row[4];
	
	echo "<td align=\"left\" valign=\"top\">$mediaName</td>";
	//echo "<td align=\"left\" valign=\"top\">$categoryID</td>";
	
	$query = "select categoryName from media_category where categoryID='$categoryID'";
	$result2 = mysql_query($query);
	$row2 = mysql_fetch_array($result2);
	$mz = $row2[0];
	//echo "<td align=\"left\" valign=\"top\">$mz</td>";
	
	
	echo "<td align=\"left\" valign=\"top\">$mediaDescrip</td>";
	echo "<td align=\"right\" valign=\"top\"><form action=\"modpress.php\" method=\"post\"><input type=\"hidden\" name=\"id\" value=\"$mediaID\"><input type=\"submit\" value=\"Modify\"></td></form>";
	echo "<td align=\"left\" valign=\"top\"><form action=\"delpress.php\" method=\"post\"><input type=\"hidden\" name=\"id\" value=\"$mediaID\"><input type=\"submit\" value=\"Delete\"></td></form>";
	echo "</tr>";
}
?>

</table>

</center>



<?php
include "footer.php";
?>