CodeIgniter使用this-> db->查询分页

如何在$ this-&gt; db-&gt; query()方法中使用codeigniter?</ p>

如果我使用活动记录类,我会这样做:</ p>

  $ query = $ this-&gt; db-&gt; get('tb_cash_transaction'  ,$ num,$ offset); 
$ this-&gt; db-&gt; order_by(“CURRENCY_ID”,“asc”);

</ code> </ pre>

现在我正在使用$ this-&gt; db-&gt; query()</ p>

  $ query  =“SELECT * FROM tb_cash_transaction,tb_currency,tb_user其中tb_cash_transaction.CURRENCY_ID = tb_currency.CURRENCY_ID和tb_cash_transaction.USER_ID = tb_user.USER_ID和TYPE ='cash_out'”;

$ query = $ this-&gt; db-&gt; query($ query);
</ code> </ pre>

如何实现它? 谢谢。</ p>
</ div>

展开原文

原文

How to use the codeigniter with $this->db->query() method?

If i use active record class i would do like this:

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

Now i am using the $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);

How to implement it? Thank you.

1个回答



试试这个.. </ p>

  $ query =“SELECT * FROM tb_cash_transaction  ,tb_currency,tb_user其中tb_cash_transaction.CURRENCY_ID = tb_currency.CURRENCY_ID和tb_cash_transaction.USER_ID = tb_user.USER_ID和TYPE ='cash_out'按CURRENCY_ID排序asc LIMIT $ offset,$ num“; 
$ query = $ this-&gt; db- &gt;查询($查询);
</ code> </ pre>

希望这会有所帮助。</ p>

谢谢!</ p>
\ n

Hussain </ p>
</ div>

展开原文

原文

Try with this one..

$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);

Hope this will Help.

Thanks!

Hussain

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐