Ive gone and found myself a bit of script that allows me to successfully search my database for all items that relate to what is entered in the search field. just want to be able to change slightly how the results are displayed and the search bit itself slightly
Want it so the user can search in a box that is already been placed on all of my pages
Want the results to be displayed 10 results at a time and the remaining to be displayed on page2
this is code i am using if anyone can help it would be greatly appreciated:
<html>
<head><title>Search</title></head>
<body>
<?php
error_reporting(E_ALL ^ E_NOTICE);
include ("func.inc");
connectDB();
case "search":
searchForm();
echo '<h3>Search Results:</h3><br />';
$searchstring = mysql_escape_string($_GET['words']);
switch($_GET['mode'])
{
case "normal":
$sql = "SELECT ProductName, ProductDescription, Url,
MATCH(ProductName, ProductDescription, Url)
AGAINST ('$searchstring') AS score FROM Products
WHERE MATCH(ProductName, ProductDescription, Url)
AGAINST ('$searchstring') ORDER BY score DESC";
break;
case "boolean":
$sql = "SELECT ProductName, ProductDescription, Url,
MATCH(ProductName, ProductDescription, Url)
AGAINST ('$searchstring' IN BOOLEAN MODE) AS score FROM Products
WHERE MATCH(ProductName, ProductDescription, Url)
AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY score DESC";
break;
}
// echo $sql;
$result = mysql_query($sql) or die (mysql_error());
Bookmarks