<?php 

/**
 * conexion PDO en class
 */
class db{	
	private $servidor = "45.79.38.135";
	private $db = "sicanets_solidez_desarrollo";
	private $port = "3306";
	private $charset = "utf8";
	private $usuario = "desarrolloweb";
	private $pass = "desarrolloweb";
	private $socket = "";
	private $pdo = null;

	private $opciones = [PDO::ATTR_CASE => PDO::CASE_LOWER, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ORACLE_NULLS => PDO::NULL_TO_STRING, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ];
	
	function __construct(){
		$this->pdo = new PDO("mysql:host={$this->servidor};dbname={$this->db};port={$this->port};charset={$this->charset}",$this->usuario,$this->pass,$this->opciones);
	}

	public function pdo(){
		return $pdo;
	}

	public function db_close() {
      $pdo=null;
    }

    public function query_return($sql){
        return $this->pdo->query($sql);
    }
}
/*try{
	$tablas = $pdo->query("select * from inversiones");
	foreach ($tablas as $tabla) {
	print_r($tabla);
	echo "<br>";
	}

	$inversiones = $pdo->query("select * from inversiones");
	while ($inversion = $inversiones->fetch()) {
		echo $inversion->importe."<br>";
	}
}catch(PDOException $ex){
	echo $ex->getMessage();
}*/


 ?>