Forum Moderators: coopster
<?php
include("config.php");
include("constants.php");
?>
<?php
function makeDrop ($database,$table,$teamname,$groups)
{
include("config.php");
$query = "select id,name from category order by name";
$results = MYSQL_QUERY($query);
if (mysql_Numrows($results)>0)
{
$numrows=mysql_NumRows($results);
$x=0;
while ($x<$numrows)
{
$id=mysql_result($results,$x,"id");
$name=mysql_result($results,$x,"name");
echo "<option value=\"$id\">$name</option>\n";
$x++;
}
}
}
?>
<h2>Print Booklist by Staff</h2>
<br>Select a category to Print out a Staff<br>
<form method="post" action="search_results.php">
<table>
<tr>
<td><font color=blue><b>Choose a Category :</b></font></td>
<td><select name="catid">
<?php
echo"<option value=\"-1\" selected>All Categories</option>";
makeDrop("health_data","category","id",$name);
?>
</select>
</td>
</tr>
<tr>
<td> </td>
<td>
<br>
<input type="submit" name="Submit" value="Get Book List">
<input type="reset" value="Clear" name="Reset">
</td>
</tr>
</table>
</form>
</body>
<html> <?php
include("config.php");
include("constants.php");
?>
<?php
if ($catid=="-1")
{
$catname="All Categories";
$thisKeyword = $_REQUEST['catid'];
$query = "SELECT * FROM staff WHERE id like '%$thisKeyword%' OR title like '%$thisKeyword%'";
}
else
{
$thisKeyword = $_REQUEST['catid'];
$query = "SELECT * FROM staff WHERE id like '%$thisKeyword%' OR title like '%$thisKeyword%'";
}
$result = MYSQL_QUERY($query);
$numberOfRows = MYSQL_NUM_ROWS($result);
/* How many of these books are there? */
if ($result>0) { $number = MYSQL_NUM_ROWS($result); }
else {$number=0;}
/* Print these results to the screen in a nice format */
$i = 0;
IF ($number == 0)
{
echo "<h2>Sorry, No books found in Category </font> !</h2>";
}
else if($number>0)
{
echo "<br><h3><b>Category:</b>$thisKeyword</h3>";
echo "<h4>$number books found:<b> $number</b></h4>";
?>
<?php
WHILE ($i < $number):
$q=$i+1;
$book_id1 = mysql_result($result,$i,"id");
$name1 = mysql_result($result,$i,"name");
$year1 = mysql_result($result,$i,"year");
$check=checkbookstatus($bookid1);
$catsymbol=getcatsymbol($catid);
?>
<? echo $check; ?>
<? echo $name1; ?>
<? echo $year1; ?>