<?php
//include("JSON.php");

//$conng = mysqli_connect('ftp.em-empire.com','sysconex_syscone','6^xTXeGT1Suy','sysconex_syscobd');
class DBController {
	private $conn = "";
	private $host = "ftp.em-empire.com";
	private $user = "sysconex_syscone";
	private $password = "6^xTXeGT1Suy";
	private $database = "sysconex_syscobd";
	//private $host = "localhost";
	//private $user = "em-empire";
	//private $password = "188919391945";
	//private $database = "mcm";
	function __construct() {
		$conn = $this->connectDB();
		if(!empty($conn)) {
			$this->conn = $conn;			
		}
	}
	function connectDB() {
		$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
		$conn-> set_charset("utf8");
		return $conn;
	}
	function executeSelectQuery($query) {
		$result = mysqli_query($this->conn,$query);
		while($row=mysqli_fetch_assoc($result)) {
			$resultset[] = $row;
		}
		if(!empty($resultset))
			return $resultset;
	}
	function executeInsertQuery($query) {
		echo $query;
		if (mysqli_query($this->conn,$query)) {
      		return "ok";
		} else {
      		return "Error: " . $query . "<br>" . mysqli_error($conn);
		}
		
	}
}



?>