如何在$ this-> db-> query()方法中使用codeigniter?
如果我使用活动记录类,我会这样做:
$query = $this->db->get('tb_cash_transaction',$num,$offset);
$this->db->order_by("CURRENCY_ID", "asc");
现在我正在使用$ this-> db-> query()
$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);
如何实施?谢谢。
答案 0 :(得分: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);
希望这会有帮助。
谢谢!
侯赛因