<?php
// Connect to database
include "admin/include/connect.php";
dbconnect();
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Quotes by Category</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?
$ID = $_REQUEST['ID'];
$CategoryQuery = "SELECT * FROM CategoryTBL WHERE Id=$ID";
$CategoryResult = mysql_query($CategoryQuery) or die ( mysql_error() );
while ($row = mysql_fetch_array($CategoryResult, MYSQL_ASSOC))
{
$Category = $row["Category"];
}
?>
<link href="quotation.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#FFFFFF">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F8F8E3">
<tr>
<td><?php require_once('header.html'); ?></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<table width="780" border="0" align="center" cellspacing="0" cellpadding="0">
<tr><td align="center"><img src="images/grey_dot.gif" height="1" width="770"/></td></tr>
<tr><td align="center"><img src="images/spacer.gif" height="10" width="770"/></td></tr>
<tr><td align="center" class="pageTitles"><? echo "$Category"; ?></td></tr>
<tr><td align="center"><img src="images/spacer.gif" height="10" width="770"/></td></tr>
<tr><td align="center"><img src="images/grey_dot.gif" height="1" width="770"/></td></tr>
</table></td></tr>
<tr>
<td>
<?
$ID = $_REQUEST['ID'];
$QuotationsQuery = "SELECT * FROM QuotationsTBL WHERE CategoryID=$ID AND Approved='Yes' ORDER by AuthorID ASC";
$QuotationsResult = mysql_query($QuotationsQuery) or die ( mysql_error() );
$Quotations_num_rows = mysql_num_rows($QuotationsResult);
echo "<table align=\"center\" width=\"700\" border=\"0\" cellspacing=\"10\" cellpadding=\"5\">\n";
if ($Quotations_num_rows == 0 ) {
echo "<tr>";
echo "<td align=\"center\" class=\"bodyCopy\">There are no quotations in the $Category category in the database.</td>";
echo "</tr>";
} else
while ($row = mysql_fetch_array($QuotationsResult, MYSQL_ASSOC))
{
// Assign a variable name for each field in the current row.
$Category_ID = $row["CategoryID"];
$Quotation = $row["Quotation"];
$Author_ID = $row["AuthorID"];
$Quotation_Source = $row["Source"];
?>
<?
$AuthorQuery = "SELECT * FROM AuthorTBL WHERE Id=$Author_ID";
$AuthorResult = mysql_query($AuthorQuery) or die ( mysql_error() );
$Author_num_rows = mysql_num_rows($AuthorResult);
echo "<tr>";
echo "<td>";
echo "<table align=\"left\" width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
while ($row = mysql_fetch_array($AuthorResult, MYSQL_ASSOC))
{
$Author_Fname = $row["Firstname"];
$Author_Lname = $row["Lastname"];
$Author_Profession = $row["Profession"];
$Author_Country = $row["Country"];
$Author_DOB = $row["DOB"];
// If author is 'anonymous' don't print first name, etc.
if ($Author_Lname == " Anonymous"){
echo "
<tr><td class=\"bodyBold\">$Author_Lname</td></tr>
</table></td></tr>";
} else
echo "
<tr><td class=\"bodyCopy\"><strong>$Author_Fname $Author_Lname</strong>
<em>• $Author_Profession • $Author_Country • $Author_DOB</em></td></tr>
</table></td></tr>";
}
echo "
<tr><td><div class=\"Quotation\">$Quotation</div></td></tr>
<tr><td class=\"bodyCopy\" align=\"right\"><em>$Quotation_Source</em></td></tr>";
}
?>
<tr><td> </td></tr>
<tr>
<td class="bodyCopy"><br /> <a href="category.php">Back to category list</a><br />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center"><?php require_once('footer.html'); ?></td>
</tr>
</table>
</body>
</html>