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

[eluser]l1v1[/eluser]
Code:
public function search($key)
{
  $query = $this->db->query('SELECT * FROM upload WHERE name LIKE "%'.$key.'%"');
  $this->num_rows = $query->num_rows();
  $val = $query->result_array();
  
  return $query;
}
Why are you returning $query variable? I think you need to return the $val variable.
If you will return $val variable, then you can simply in your controller do this:
Code:
$val_array = $this->some_sort_model->search($key);
for($i=0;$i<count($val_array);$i++){
echo $val_array[$i];
}


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