jronyagz Posted December 3, 2006 Share Posted December 3, 2006 Hello guys...public function find_by_param($array) { if ($array){ if ($array['item']['name'] = "") { $condition_param .= " lower(firstname) LIKE '%".strtolower($array['item']['name'])."%' OR lower(lastname) LIKE '%".strtolower($array['item']['name'])."%'"; } else { $condition_param .= ''; } if ($array['item']['keyword'] = "") { $condition_param .= " AND lower(state) LIKE '%".strtolower($array['item']['keyword'])."%'"; } else { $condition_param .= ''; } if ($array['item']['city'] = "") { $condition_param .= " AND lower(city) LIKE '%".strtolower($array['item']['city'])."%'"; } else { $condition_param .= ''; } if ($array['item']['province'] = "") { $condition_param .= " AND lower(province) LIKE '%".strtolower($array['item']['province'])."%' "; } else { $condition_param .= ''; } if (!$array['item']['country'] = "Any Country") { $condition_param .= " And country = '".$array['item']['country']."' "; } else { $condition_param .= ''; } if (!$array['item']['nationality'] = "Any Nationality") { $condition_param .= " And nationality = '".$array['item']['nationality']."' "; } else { $condition_param .= ''; } if (!$array['item']['height'] = "Any Height") { $condition_param .= " And height = '".$array['item']['height']."' "; } else { $condition_param .= ''; } if (!$array['item']['body_shape'] = "Any Body Shape") { $condition_param .= " And body_shape = '".$array['item']['body_shape']."'"; } else { $condition_param .= ''; } if (!$array['item']['best_body_feature'] = "Any Body Feature") { $condition_param .= " And best_body_feature = '".$array['item']['best_body_feature']."' "; } else { $condition_param .= ''; } if (!$array['item']['hair_color'] = "Any Hair Color") { $condition_param .= " And hair_color = '".$array['item']['hair_color']."' "; } else { $condition_param .= ''; } if (!$array['item']['ethnicity'] = "Any Ethnicity") { $condition_param .= " And ethnicity = '".$array['item']['ethnicity']."' "; } else { $condition_param .= ''; } if (!$array['item']['religion'] = "Any Religion") { $condition_param .= " And religion = '".$array['item']['religion']."' "; } else { $condition_param .= ''; } if (!$array['item']['marital_status'] = "Any Marital Status") { $condition_param .= " And marital_status = '".$array['item']['marital_status']."' "; } else { $condition_param .= ''; } if (!$array['item']['children'] = "Any Children") { $condition_param .= " And children = '".$array['item']['children']."' "; } else { $condition_param .= ''; } if (!$array['item']['drinking'] = "Any Drinking") { $condition_param .= " And drinking = '".$array['item']['drinking']."' "; } else { $condition_param .= ''; } if (!$array['item']['smoking'] = "Any Smoking") { $condition_param .= " And smoking = '".$array['item']['smoking']."' "; } else { $condition_param .= ''; } $condition_param = $condition_param; $query = "SELECT m.* FROM members as m $condition_param ORDER BY firstname "; $result = $this->find_by_sql($query); return $result; } }could anyone tell me whats wrong with this above code...any idea? Quote Link to comment Share on other sites More sharing options...
papaface Posted December 3, 2006 Share Posted December 3, 2006 Do you get an error? If so, what? Quote Link to comment Share on other sites More sharing options...
jronyagz Posted December 3, 2006 Author Share Posted December 3, 2006 SELECT m.* FROM members as m ORDER BY firstnameThis is the query result on my database.log no error but it will just disply all the members ditails even if i havent selected a values on the select box...i dont have any idea why. Quote Link to comment Share on other sites More sharing options...
jronyagz Posted December 3, 2006 Author Share Posted December 3, 2006 i whant to know if this code is correct..... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.