ItsmeMarvic
ItsmeMarvic

Reputation: 11

Order_by not functioning

i have this query but when the output displays its not sorted

function get_productbyid($productid) {
        $this->db->select('*')->from('projquotedetails,products')
                              ->where(array('projquotedetails.productid' => $productid))
                              ->where('projquotedetails.productid = products.productid')
                              ->order_by('page_order','asc')
                              ;

        $query = $this->db->get();

        if ($query->num_rows() > 0) { return $query->result_array(); }
        else                        { return 0; }

    }

Upvotes: 0

Views: 46

Answers (1)

Ravi Makwana
Ravi Makwana

Reputation: 375

Query ::

     function get_productbyid($productid) {
    $this->db->select('*')->from('projquotedetails,products')
                          ->where(array('projquotedetails.productid' => $productid))
                          ->where('projquotedetails.productid = products.productid')
                          ->order_by('projquotedetails.page_order','asc')
                          ;

    $query = $this->db->get();

    if ($query->num_rows() > 0) { return $query->result_array(); }
    else                        { return 0; }

}

Upvotes: 1

Related Questions