Order BY not working

#8
[eluser]Georgi Veznev[/eluser]
Here is the code that is causing the problems.
I think that this should work:

Code:
function getAll($a_where = '', $a_order = null) {
    $a_data = Array();

    if ($a_where != ''){
        $this->db->where($a_where);
    }
    if (!is_null($a_order)){
        if (is_array($a_order)){
            foreach($a_order as $a_entry => $s_order){
                $this->db->order_by($a_entry, $s_order);
            }
        } else {
            $this->db->order_by($a_order, 'asc');
        }
    }
    $o_query = $this->db->get($this->s_table);
    
    if ($o_query->num_rows() > 0){
        foreach ($o_query->result_array() as $a_row){
            $a_data[] = $a_row;
        }
    }
    
    $o_query->free_result();
    return $a_data;
}


Messages In This Thread
Order BY not working - by El Forum - 11-14-2010, 11:47 AM
Order BY not working - by El Forum - 11-14-2010, 11:52 AM
Order BY not working - by El Forum - 11-14-2010, 12:08 PM
Order BY not working - by El Forum - 02-19-2011, 01:44 PM
Order BY not working - by El Forum - 02-19-2011, 03:00 PM
Order BY not working - by El Forum - 02-19-2011, 06:30 PM
Order BY not working - by El Forum - 02-20-2011, 10:48 AM
Order BY not working - by El Forum - 02-20-2011, 12:36 PM
Order BY not working - by El Forum - 02-20-2011, 07:46 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.