<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
    class Google_model extends CI_Model {
 
        public function __construct()
    {
        parent::__construct();
    }

        
        public function get_list($user_id,$date) {
  
        $query = $this->db->get_where('map',array('userid'=>$user_id,'date'=>$date));
        return $query->result();
      
        }
        function get_coordinates($user_id)
        {//print_r($user_id);die();
            $return = array();
            $this->db->select("lattitude,longitude,date");
            $this->db->where('userid',$user_id);
           $this->db->from("map");
            $query = $this->db->get();
            if ($query->num_rows()>0)
            {
                foreach ($query->result() as $row)
                {
                    array_push($return, $row);
                }
            }
            return $return;
        }
         function get_coordinatess($user_id)
        {//print_r($user_id);die();
            $return = array();
            $this->db->select("lattitude,longitude,date");
            $this->db->where('userid',$user_id);
           $this->db->from("map");
            $query = $this->db->get();
            if ($query->num_rows()>0)
            {
               // array_push($return, $row);$query->last_row()
                return $query->first_row();
            }
            //return $return;
        }
        function get_coordinatesss($user_id)
        {//print_r($user_id);die();
            $return = array();
            $this->db->select("lattitude,longitude,date");
            $this->db->where('userid',$user_id);
           $this->db->from("map");
            $query = $this->db->get();
            if ($query->num_rows()>0)
            {
               // array_push($return, $row);$query->last_row()
                return $query->last_row();
            }
            //return $return;
        }
       public function getInvoiceByID($id)
    {

        $q = $this->db->get_where('sales', array('id' => $id), 1);
        if ($q->num_rows() > 0) {
            return $q->row();
        }

        return FALSE;
    }
    }
?>