Location: PHPKode > projects > Helpdesk Over Web > how/kb/searchcat.php
// Search Results Page

// Include Configuration File

// Set Page Title and Include HTML Header
$page_title = 'HOW - Knowledgebase - Search Results';

echo '<H1>Solutions Knowledgebase</H1>';

// Connect to Database
require_once ('../includes/mysql_connect.php');

// Retrieve Results from Form
$category = $_POST['category'];

// Query the database.
$query = "SELECT * FROM knowledgebase WHERE category LIKE '%$category%';";		
$result = mysql_query($query)
   or die("Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows == 0)
	echo "<H4>Sorry - No Entries Found</H4>";
	echo ("<P><B><A HREF='javascript:history.back()'>Back to Previous Page</A></B></P>");
else {
echo '<p>Click on a solution title to view further details and to edit or delete.</P>';
echo ("<TABLE WIDTH='600'><TR><TD WIDTH='250'><b>Category</b></TD><TD width='350'><b>Title</b></TD><TD></TD><TD></TD></TR>");
while($i = mysql_fetch_row($result)) { 
	echo ("<TR>");
	echo ("<TD>$i[1]</TD>");
	echo ("<TD>$i[2]</TD>");
	echo ("<TD><A HREF='view.php?entry=$i[0]'>View&nbsp;&nbsp;</A></TD>");

// Print option for editing if User Role set (i.e. if user logged in)
if($_SESSION['Role'] != '')
		echo ("<TD><A HREF='edit.php?entry=$i[0]'>Edit</A></TD>");	
echo ("</TABLE>");
echo ("<P><P><B>Total Entries: </B> $num_rows</P>");
echo ("<P><B><A HREF='javascript:history.back()'>Back to Previous Page</A></B></P>");
// Include HTML footer.
Return current item: Helpdesk Over Web