I need to omit words that are less then 4 characters in my search query.
[code=php]<?php
$VarSearch_Criteria = ($_POST[“TxtSearch”]);
$outputsearch = explode(” “,($VarSearch_Criteria));
$matches = implode(“%’ OR Key_Words LIKE ‘%”,$outputsearch);
$charlength = strlen($outputsearch);
if ($VarSearch_Criteria == ”) {
echo “Please Enter Search Criteria”;
}
else
{
print_r($outputsearch);
echo($charlength);
$query = (“select * FROM Chamber_Members WHERE Key_Words LIKE ‘%” .$matches . “%’ AND $charlength > 3”);
$result=mysql_query($query) or die (‘Error: ‘.mysql_error ());
echo($query);
while($row = mysql_fetch_array($result))
{
$logo = trim($row[‘Business_Image’]);
$output .= “<h3>” . $row[‘Business_Name’] . “</h3>” . “<br />”;
$output .= $row[‘Business_Address’] . “<br />”;
$output .= $row[‘City’] . “, ” . $row[‘State’] . “<br />”;
$output .= $row[‘Zip’] . “<br />”;
$output .= “Phone: ” . $row[‘Business_Phone’] . “<br />”;
$output .= “Fax: ” . $row[‘Business_Fax’] . “<br />”;
$matched_keywords == “”
?>
for some reason this always returns a value of 5 for $charlength I am sure the issue is that I am looking at an array.