<?php 

Class Operator extends CI_Model
{
	function getting()
	{
		$data = [];
		$this->odbc = $this->load->database('odbc',true);
		$this->mysqli = $this->load->database('mysqli',true);
		$query =  $this->odbc->query('select * from operators');
		debug($query->result_array(),1);
		foreach($query->result_array() as $row)
		{
			$data['ref'] = $row['REF'];
			$data['loginname'] = $row['LOGINNAME'];
			$data['fullname'] = $row['FULLNAME'];
			$data['accesslevel'] = $row['ACCESSLEVEL'];
			$data['password'] = $row['PASSWORD_'];
			$data['lastin'] = $row['LASTIN'];
			$data['lastout'] = $row['LASTOUT'];
			$data['custref'] = $row['CUSTREF'];
			$data['depot'] = $row['DEPOT'];
			$data['type'] = $row['TYPE_'];
			$data['logintype'] = $row['LOGINTYPE'];
			$data['costcentre'] = $row['COSTCENTRE'];
			$data['contractarea'] = $row['CONTRACTAREA'];
			$data['office'] = $row['OFFICE'];
			$data['emailaddress'] = $row['EMAILADDRESS'];
			$data['createdate'] = $row['CREATEDATE'];
			$data['termsagree'] = $row['TERMSAGREED'];
			
			/*INERT INTO MYSQL DATABASE*/
			$this->mysqli->insert('operators', $data);
		}
	}

	function getting_db()
	{
		$this->odbc = $this->load->database('odbc',true);
		$query =  $this->odbc->query("select * from CREATEAPPLOGIN('447900162308','1230')");
		debug($query->result_array(),1);
	}
}