<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Copy_Location_Model extends CI_Model {
  
    

    function getSelectedTableData() {     
        $table_name = $this->input->post('table_name');
        $this->db->where('country_id',$this->input->post('country_id'));
        $this->db->where('province_id',$this->input->post('province_id'));
        $query = $this->db->get($table_name);
        $result = $query->result_array();
        return $result;
    }
  

    function copyData($output) {
        ini_set('max_execution_time', 30);
        $table_name = $this->input->post('table_name');
        $this->input->post('country_id1');
        $this->input->post('province_id1');
        foreach($output as $data){
            $this->db->set('page_title',$data['page_title']);
            $this->db->set('page_heading',$data['page_heading']);
            $this->db->set('page_heading',$data['page_heading']);
            $this->db->set('page_content',$data['page_content']);
            $this->db->set('content_type',$data['content_type']);
            $this->db->set('country_id',$this->input->post('country_id1'));
            $this->db->set('province_id',$this->input->post('province_id1'));
            
            $this->db->set('status', 'active');
            $this->db->set('add_time', time());
            $query = $this->db->insert($table_name);
            $response = $this->db->insert_id();
        }     
        
        return $response;
    }  


}