2011-01-05 63 views
0

如何在$ this-> db-> query()方法中使用codeigniter?CodeIgniter分頁與this-> db->查詢

如果我使用Active Record類,我會做這樣的:

$query = $this->db->get('tb_cash_transaction',$num,$offset); 
$this->db->order_by("CURRENCY_ID", "asc"); 

我現在用的這 - $> DB->查詢()

$query = "SELECT * FROM tb_cash_transaction, tb_currency, tb_user where tb_cash_transaction.CURRENCY_ID=tb_currency.CURRENCY_ID and tb_cash_transaction.USER_ID=tb_user.USER_ID and TYPE='cash_out'"; 
$query = $this->db->query($query); 

如何實現的呢?謝謝。

回答

2

與這一個嘗試..

$query = "SELECT * FROM tb_cash_transaction, tb_currency, tb_user where tb_cash_transaction.CURRENCY_ID=tb_currency.CURRENCY_ID and tb_cash_transaction.USER_ID=tb_user.USER_ID and TYPE='cash_out' order by CURRENCY_ID asc LIMIT $offset , $num"; 
$query = $this->db->query($query); 

希望這將有助於。

謝謝!

Hussain