This problem arose in my final project at the university and it is a web page with PHP oriented to objects, and ORACLE database manager, everything was fine with the connection until when executing a procedure in PHP he does not do anything.
I will leave you a part of how I have structured the project, (I'm doing the user module)
This is my Conexion class
<?php
class Connection
{
public $connection;
public function __CONSTRUCT()
{
try{
$this->connection = new PDO('oci:dbname=//localhost:1521/orcl',"username", "userpassword");
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){
die($e->getMessage());
}
}
public function __getConnection()
{
return $this->connection;
}
}
This is my User class
<?php
class Usuario
{
public $IdUsuario;
public $Email;
public $Clave;
public $Rol;
public $Estado;
public $NombreUsuario;
public $Foto;
public $CodigoActivacion;
public $Sexo;
public $Tstamp;
public function __GET($k)
{
return $this->$k;
}
public function __SET($k, $v)
{
$this->$k = $v;
}
}
this is my User Model class
<?php
/**
*
*/
require_once _dependencia_.'Objects/Usuario.php';
require_once _dependencia_.'Connection/Connection.php';
require_once _dependencia_.'Model/SesionModel.php';
require_once _dependencia_.'Objects/Sesion.php';
class UsuarioModel
{
private $connection;
public function __construct()
{
try {
$c = new Connection();
$this->connection = $c->__getConnection();
} catch (Exception $e) {
die($e->getMessage());
}
}
public function save($Usuario)
{
try {
$sql = 'INSERT INTO Usuario (NombreUsuario, Email, Clave, Rol, Estado, Foto, CodigoActivacion,Sexo)
VALUES (?, ? ,? ,? ,? ,? ,?,?)';
return $this->connection->prepare($sql)
->execute(
array(
$Usuario->__GET('NombreUsuario'),
$Usuario->__GET('Email'),
$Usuario->__GET('Clave'),
$Usuario->__GET('Rol'),
$Usuario->__GET('Estado'),
$Usuario->__GET('Foto'),
$Usuario->__GET('CodigoActivacion'),
$Usuario->__GET('Sexo'),
)
);
} catch (Exception $e) {
die($e->getMessage());
return false;
}
}
and this is my constant class
<?php
define("_ROOT_","http://localhost/SistemaBayerWeb/");
define("_dependencia_","C:/xampp/htdocs/SistemaBayerWeb/");
?>