[eluser]handoyo[/eluser]
Hi,i found a code like this from oscommerce.
Code:
$orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from ".TABLE_ORDERS." o left join ".TABLE_ORDERS_TOTAL." ot on (o.orders_id = ot.orders_id), ".TABLE_ORDERS_STATUS." s where o.customers_id = '".(int) $cID."' and o.orders_status = s.orders_status_id and s.language_id = '".(int) $languages_id."' and ot.class = 'ot_total' order by orders_id DESC";
I'm trying to change it to active record according to my table..
Code:
$Q=$this->db->from('orders');
$Q=$this->db->join('orders_total','orders_total.orders_id=orders.orders_id','left');
$Q=$this->db->join('orders_status','orders.orders_id=orders_status.orders_status_id');
$Q=$this->db->where('orders.orders_id',$id);
$Q=$this->db->where('orders_total.class','ot_total');
$Q=$this->db->where('orders.orders_status','orders_status.orders_status_id');
$Q=$this->db->get();
Are there anything wrong with the code?Also is it possible if i don't use ON orders.orders_id =orders_status.orders_status_id?Thanks