pagiantion from one query


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $query = $this->db->query("SELECT * FROM (user_fav_doc) JOIN ica_user_master ON ica_user_master.user_id =user_fav_doc.owner_id JOIN ica_document ON ica_document.document_id =user_fav_doc.document_id JOIN ica_transaction_group ON ica_transaction_group.transaction_id =ica_document.transaction_group_id JOIN ica_transaction_type ON ica_transaction_type.trans_type_id =ica_document.transaction_type_id WHERE user_fav_doc.user_id =$user_id ORDER BY owner_id desc LIMIT $offset, $limit");
  2. $arr=explode("LIMIT",$this->db->last_query());
  3. //echo $arr[0];
  4. $res=mysql_query($arr[0]);
  5. $count=mysql_num_rows($res);
  6. $data=array();
  7. foreach($query->result() as $row)
  8. {
  9. $data[]=$row;
  10. }
  11. $data[]=$count;
  12. if(count($data)>0)
  13. {
  14. return $data;
  15. }else
  16. {
  17. return 0;
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.