I've created a php search script to search a MySQL database but no search is returning results.
Form Code
<form method="post" action="search.php">
<input type="text" value="Search..." name="query" />
<input type="submit" value="Find" name="completedsearch" />
</form>
PHP Script
<?php
if(isset($_POST['completedsearch']))
{
$term = $_POST['query'];
$mysql = mysql_connect("localhost","searchuser","password");
mysql_select_db("hcsd");
$qu = mysql_query("SELECT * FROM your_table WHERE COMPANY LIKE '%{$term}%' OR LOCATION LIKE '%{$term}%' OR KEYWORDS LIKE '%{$term}%' OR PRODUCTSSERVICES LIKE '%{$term}%' ");
echo "
<th>Name</th>
<th>Location</th>
<th>Products/Services</th>
";
while($row = mysql_fetch_array($qu))
{
echo "<tr><td>";
echo $row['COMPANY'];
echo "</td>";
echo "<td>";
echo $row['LOCATION'];
echo "</td>";
echo "<td>";
echo $row['PRODUCTSSERVICES'];
echo "</tr></td>";
}
}
?>
The MySQL database has 4 columns, headed COMPANY, LOCATION, KEYWORDS & PRODUCTSSERVICES, and this script should be searching any of the columns for the search term and then displaying COMPANY, LOCATION and PRODUCTSSERVICES for any matching rows in a table, yet even using search terms I know 100% are in the MySQL table, I'm still receiving no results.