Advertisement
Advertisement
| 05.18.2008 at 08:09AM PDT, ID: 23411926 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: |
//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
//
//--//--// PROCESS SEARCH //--//
// Specify how many results to display per page
$limit = 8;
// Get the search variable from URL
$var = @$_POST['search-input'];
// Trim whitespace from the stored variable
$trimmed = trim($var);
// Separate key-phrases into keywords
$trimmed_array = explode(" ",$trimmed);
// Check for an empty string and redirect || Check for no search var and redirect
if ($trimmed == "" || !isset($var))
redirect('/search-empty/');
// Build SQL Query for each keyword entered
foreach ($trimmed_array as $trimm){
// SET QUERY VARS
$db_table = 'for_search';
$db_values = array('mach_id');
$db_where = 'WHERE manu_name LIKE "%'.$trimm.'%" OR name LIKE "%'.$trimm.'%" OR details LIKE "%'.$trimm.'%"';
$db_order = 'ORDER BY (CASE WHEN manu_name LIKE "%'.$trimm.'%" THEN 1 ELSE 0 END + CASE WHEN name LIKE "%'.$trimm.'%" THEN 1 ELSE 0 END + CASE WHEN details LIKE "%'.$trimm.'%" THEN 1 ELSE 0 END) DESC';
$db_return = 'm_arr';
//select_record($db_table, $db_values, $db_where, $db_order, $db_return);
// Execute the query to get number of rows that contain search kewords
$row_num_links_main = get_rows($db_table, $db_values, $db_where, $db_order, $db_return);
// next determine if 's' has been passed to script, if not use 0.
// 's' is a variable that gets set as we navigate the search result pages.
if (empty($s)) {
$s=0;
}
// now let's get results.
$db_order .= " LIMIT $s,$limit" ;
$row_num_links_main = select_record($db_table, $db_values, $db_where, $db_order, $db_return);
//store record id of every item that contains the keyword in the array we need to do this to avoid display of duplicate search result.
foreach($row_num_links_main as $r)
$adid_array[] = $r['mach_id'];
}
} //end foreach
if($row_num_links_main == 0 && $row_set_num == 0){
// Put no search results redirects here - send get var with search
redirect('/search-empty/');
}
//delete duplicate record id's from the array. To do this we will use array_unique function
$tmparr = array_unique($adid_array);
$i=0;
foreach ($tmparr as $v) {
$newarr[$i] = $v;
$i++;
}
// now you can display the results returned.
|