Welcome Guest, Not a member yet? Register   Sign In
distinct() ignored?
#1

[eluser]face1m[/eluser]
controller function

function search()
{
$data['title'] = "Welcome to Chicago";
//$this->db->distinct('bizCat');
$this->db->distinct()->like('bizCat', $this->uri->segment(3), 'after')->limit(200);
$data['query'] = $this->db->get('biz_illinois_chicago');

$this->load->view('search_view', $data );

}

This query works, BUT the distinct function isn't even seen. PHP 5.3 Mac snow leopard apache2.2

if i write out $sql = "select ...etc";
it works. thanks in advance.
rick
#2

[eluser]face1m[/eluser]
after a little playing around i got it on my own.

$this->db->select('distinct(bizCat)')->from('biz_illinois_chicago')->like('bizCat', $this->uri->segment(3), 'after')->limit(100);

someone should put this in the manual.
#3

[eluser]Zack Kitzmiller[/eluser]
$this->db->distinct() works as expected here, with a very similar setup.

You can see the SQL that was generated using $this->db->last_query(), that might help you trouble shoot.
#4

[eluser]face1m[/eluser]
Thanks a bunch! I will use it.

rick




Theme © iAndrew 2016 - Forum software by © MyBB