Welcome Guest, Not a member yet? Register   Sign In
PHP search with spaces
#6

[eluser]l1v1[/eluser]
You have to explode your $key variable with ' ' and run the query "x" times, like you said. I don't think if there is another way to do that.
I didn't test this code, so I don't know if it works, but try something like this:

Code:
public function search($key){
$query_array = array();
$keys = explode(' ',$key);
for($i=0;$i<count($keys);$i++{
  $this->db->like('name',$keys[$i]);
  $query = $this->db->from('upload');
   if($query->num_rows()>0){
    array_push($query_array,$query->result_array());
   }
   else{
    return FALSE;
   }
}
}


Messages In This Thread
PHP search with spaces - by El Forum - 08-22-2012, 07:30 PM
PHP search with spaces - by El Forum - 08-22-2012, 10:01 PM
PHP search with spaces - by El Forum - 08-22-2012, 10:14 PM
PHP search with spaces - by El Forum - 08-22-2012, 11:28 PM
PHP search with spaces - by El Forum - 08-23-2012, 02:51 PM
PHP search with spaces - by El Forum - 08-23-2012, 03:06 PM
PHP search with spaces - by El Forum - 08-24-2012, 06:16 AM
PHP search with spaces - by El Forum - 08-24-2012, 06:25 AM
PHP search with spaces - by El Forum - 08-24-2012, 11:28 AM
PHP search with spaces - by El Forum - 08-24-2012, 11:50 AM
PHP search with spaces - by El Forum - 08-24-2012, 05:02 PM
PHP search with spaces - by El Forum - 08-24-2012, 07:14 PM
PHP search with spaces - by El Forum - 08-24-2012, 07:35 PM
PHP search with spaces - by El Forum - 08-25-2012, 12:43 AM
PHP search with spaces - by El Forum - 08-26-2012, 01:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB