Jump to content

Search is not working


taz321

Recommended Posts

Hi

 

I have an search facility in place, but it doesn't seem to be working, any ideas why ?

 

My code below is -

 

if (($_GET['keyword'] == "") || ($_GET['category'] == "*"))	
{
	$query = "SELECT * FROM form ORDER BY formID DESC LIMIT $offset, $limit";
}
else
{
	$query = "SELECT * FROM form WHERE ".$_GET['category']." like '%".$_GET['keyword']."%' ORDER BY formID";
}
$result = mysql_query($query, $connection) or die ("Unable to perform query $query");

 

 

<form method="get" action="enquiryscreen.php" name="search">
<table width="1207" border="0">
  <tr>
    <td width="285"><div align="center"><span class="style20">Welcome <?php echo $_SESSION['firstname']?> <?php echo $_SESSION['surname']?></span></div></td>
    <td width="14"> </td>
    <td width="123"> </td>
    <td width="154"> </td>
    <td width="8"> </td>
    <td width="117"> </td>
    <td width="181"> </td>
    <td width="291"> </td>
  </tr>
  <tr>
    <td height="71"> </td>
    <td> </td>
    <td><span class="style24">Search By Keyword</span></td>
    <td><input name="keyword" type="text" id="keyword"></td>
    <td> </td>
    <td><span class="style24">Search By Category</span></td>
    <td><select name="category" class="title" id="category">
      <option value="*">Please Select</option>
      <option value="formID">Enquiry Number</option>
      <option value="issuetitle">Issue Title</option>
      <option value="datesubmitted">Date Submitted</option>
      <option value="systemaffected">System Affected</option>
      <option value="teamname">Team</option>
    </select></td>
    <td><div id="Layer6"><img src="Images/Symbol.jpg" width="135" height="129"></div></td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td>
      <div align="right">
        <input name="Clear" type="reset" class="style8" id="Clear" value="Clear">
      </div></td>
    <td> </td>
    <td><input name="Search" type="submit" class="style8" id="Search" value="Search"></td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="20"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>
</form>

 

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/95696-search-is-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.