<?php 

class orders_model extends CI_model

 {

   

	function view_order($uid)

		{

		  

		 $this->db->where('id',$uid);

		  $query=$this->db->get('contact_us'); // select * from posts where module='$type'  limit $rec_no

		  

		  if($query->num_rows() > 0)

		    return $query->result(); 

		     return FALSE;



		}

		

			function view_products($uid)

		{

		  

		 $this->db->where('session_id',$uid);

		  $query=$this->db->get('orders'); // select * from posts where module='$type'  limit $rec_no

		  

		  if($query->num_rows() > 0)

		    return $query->result(); 

		     return FALSE;



		}



		





		function get_orders($rec_no)

		{

		  
			$this->db->group_by("session_id"); 

		  $this->db->order_by("id", "desc"); 

		  $query=$this->db->get('orders',$rec_no,$this->uri->segment(3)); // select * from posts where module='$type'  limit $rec_no

		  

		  if($query->num_rows() > 0)

		    return $query->result(); 

		     return FALSE;



		}

		

		function get_num_orders()

		{
			$this->db->group_by("session_id"); 
		  $query=$this->db->get('orders'); // select * from posts where module='$type' 

		  if($query->num_rows() > 0)

		    return $query->num_rows(); 

		     return FALSE;

		}



		

		

		function add_new_category($data)

		{

		$q=$this->db->insert('categories',$data);

		return $q;

		}

		

		function update_category($data,$id)

		{

		$this->db->where('id',$id);

		$q=$this->db->update('categories',$data);

		//if($q->num_rows() > 0)

		return $q; 

		//return FALSE;

		}

	

	
         function get_client($id)
         {
           
		$this->db->where('id',$id);
		$q=$this->db->get('members');
		return $q; 

         }
	



}

