keepingbusy
Programmer
I have some coding used in an oscommerce site and I have been looking at the \advanced_search.php and \advanced_search_results.php in an effort to establish how I can get the coding to give someone an exact match when they search for a particular product. I have found this section in \advanced_search_results.php which I think may be the part that needs changing:
What I am trying to achieve is when someone types in a description, for example: HILLSIDE it will search and return all records that only = the word HILLSIDE which is in the table PRODUCTS and field PRODUCTS_MODEL
Anything else is ignored. So if there are records such HILLSIDE COUNTY these will be ignored.
As a FoxPro programmer I know the command:
will produce the desired effect, but not sure how this is done in php.
Before I start removing any of the php code, I would appreciate any help or guidance.
Many thanks
Windows Vista
Visual FoxPro Versions 6 & 9
Code:
if (isset($search_keywords) && (sizeof($search_keywords) > 0)) {
$where_str .= " and (";
for ($i=0, $n=sizeof($search_keywords); $i<$n; $i++ ) {
switch ($search_keywords[$i]) {
case '(':
case ')':
case 'and':
case 'or':
$where_str .= " " . $search_keywords[$i] . " ";
break;
default:
$keyword = tep_db_prepare_input($search_keywords[$i]);
$where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
$where_str .= ')';
break;
}
}
$where_str .= " )";
}
Anything else is ignored. So if there are records such HILLSIDE COUNTY these will be ignored.
As a FoxPro programmer I know the command:
Code:
SELECT * FROM PRODUCTS WHERE COLUMN3 LIKE "HILLSIDE"
Before I start removing any of the php code, I would appreciate any help or guidance.
Many thanks
Windows Vista
Visual FoxPro Versions 6 & 9