Welcome Guest, Not a member yet? Register   Sign In
Pagination with sorting
#14

[eluser]spyro[/eluser]
Sorry, through all the changes I forgot about that sentence.

The query that I have now is as follows

Code:
$this->db->select('a.id, a.name, a.billing_address_street,
        a.billing_address_city, a.billing_address_state, a.billing_address_postalcode,
        a.billing_address_country, a.website, a.description, ac.eighthundrednumber_c,
        ac.mechanixlooprating_c, ac.extension_c, ac.petfriendly_c, ac.womenowned_c, ac.providearide_c,
        count(mrc.id_c)',FALSE
        );
        $this->db->from('accounts a');
        $this->db->join('accounts_cstm ac', 'ac.id_c = a.id');
        $this->db->join('mech_reviews_cstm mrc', 'mrc.userid_c = a.id AND mrc.inactive_c = 1', 'left');
        $this->db->order_by('count(mrc.id_c)', 'desc');
        $this->db->order_by('ac.premiummember_c','desc');
        $this->db->where('a.billing_address_state',$state);
        
        if(!$category==0)
        {
            //if the category is not set to 0 then use category in where clause
            $this->db->where('a.category_c',$category);
        }

        $this->db->where('a.billing_address_city',$city);
        $this->db->order_by('ac.mechanixlooprating_c','desc');
        $this->db->limit($num,$offset);
        $query = $this->db->get();

The query now executes but the results are no longer correct. I am only getting 1 record back.

How do I show the query that CI is using?


Messages In This Thread
Pagination with sorting - by El Forum - 02-27-2009, 11:21 AM
Pagination with sorting - by El Forum - 02-27-2009, 11:39 AM
Pagination with sorting - by El Forum - 02-27-2009, 12:26 PM
Pagination with sorting - by El Forum - 02-27-2009, 12:48 PM
Pagination with sorting - by El Forum - 02-27-2009, 01:39 PM
Pagination with sorting - by El Forum - 02-27-2009, 01:54 PM
Pagination with sorting - by El Forum - 02-27-2009, 02:10 PM
Pagination with sorting - by El Forum - 02-27-2009, 02:19 PM
Pagination with sorting - by El Forum - 02-27-2009, 02:36 PM
Pagination with sorting - by El Forum - 02-27-2009, 02:47 PM
Pagination with sorting - by El Forum - 02-27-2009, 02:52 PM
Pagination with sorting - by El Forum - 02-27-2009, 02:58 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:08 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:16 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:27 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:28 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:34 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:40 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:42 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:52 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:56 PM
Pagination with sorting - by El Forum - 02-27-2009, 03:58 PM
Pagination with sorting - by El Forum - 02-27-2009, 04:09 PM
Pagination with sorting - by El Forum - 02-27-2009, 04:43 PM
Pagination with sorting - by El Forum - 02-27-2009, 07:10 PM
Pagination with sorting - by El Forum - 02-27-2009, 07:29 PM
Pagination with sorting - by El Forum - 02-27-2009, 07:52 PM
Pagination with sorting - by El Forum - 02-27-2009, 08:00 PM
Pagination with sorting - by El Forum - 02-27-2009, 10:20 PM
Pagination with sorting - by El Forum - 02-28-2009, 09:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB