This class is giving me a confessing job to you that I do not see error here, I already saw in php.net I think I'm following all the logic and syntax. If anyone can help me solve this problem, I am very grateful.
<?php
include_once 'Conexao.class.php';
class Administrador {
private $Nome;
private $Endereco;
private $Telefone;
private $Conn;
public function __construct() {
$this->Conn = new Conexao();
}
public function inserir($Nome, $Endereco, $Telefone){
$sql = "INSERT INTO CADPES (NOME, ENDERECO, NUMERO)VALUES(?,?,?)";
$params = array($this->Nome, $this->Endereco, $this->Telefone);
$query = sqlsrv_query($this->Conn->Conectar(), $sql, $params) or die( print_r( sqlsrv_errors(), true));
}
}
class adm and now my class Connection
<?php
class Conexao{
private $Localhost = 'NOTEBOOK101010\SQLEXPRESS';
private $User = 'sa';
private $Pass = '';
private $Database = 'ALISON';
private $Con = null;
private $Coninfo = null;
function __construct() {
//return $this->Coninfo;
}
public function Conectar(){
$this->Localhost;
$this->User;
$this->Pass;
$this->Database;
$this->Con = array("Database" => $this->Localhost, "UID" => $this->User, "PWD" => $this->Pass);
$this->Coninfo = sqlsrv_connect($this->Database, $this->Con);
return $this->Coninfo;
if($this->Coninfo){
echo "Conectou";
}else{
die(print_r(sqlsrv_error(), true));
}
}
}
?>