Here is a search script I am trying to use,, but its not working, please advise
<?php
$hostname = "";
$username = "l";
$password = "";
$database = "luke";
$connection = mysql_connect($hostname , $username , $password)
or die("cannot make connection");
$db = mysql_selectdb($database , $connection)
or die("cannot find database");
$var = $_GET['q'] ;
$trimmed = trim($var);
$query = "select CatName CatDesc from Category where CatName like '%$trimmed%' order by CatName";
$numofrows = mysql_num_rows($query);
if ($numofrows == 0)
{
echo "<h4>Results</h4>";
echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
echo "<a href=index.php>Try Again?</a><br>";
}
else
{
echo "<p>You searched for: "" . $var . ""</p>";
echo "<h4>Results</h4>";
for($i = 0; $i < $numofrows; $i++) {
$result=mysql_fetch_array($query);
if($i % 2) {
print "<TR bgcolor=\"lightblue\">\n";
} else {
PRINT "<TR bgcolor=\"white\">\n";
}
print "<TD><a href=.$result[CatName]>".strtoupper($result['CatName'])."</a></TD>";
print "<td>".$result['CatDesc']."</TD>";
print "</TR>\n";
}
}
?>