Return to Snippet

Revision: 47850
at June 17, 2011 13:31 by atul


Initial Code
$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");
		$arr=explode("LIMIT",$this->db->last_query());
			//echo  $arr[0];
		$res=mysql_query($arr[0]);
		$count=mysql_num_rows($res);
		$data=array();
		foreach($query->result() as $row)
		{
		 	$data[]=$row;
		}
		$data[]=$count;
		if(count($data)>0)
		{
		 return $data;
		}else
		{
		 return 0;
		}

Initial URL

                                

Initial Description

                                

Initial Title
pagiantion from one query

Initial Tags
query

Initial Language
PHP