buenooooo, despues de mucho sufrimiento creo haber conseguido algo "aceptable" gracias a tus consejos!
Clase de Ejemplo
Código PHP:
class user {
private $user;
private $password;
private $email;
private $db;
public function __construct($db) {
$this->db = $db;
}
public function create_user($user,$password,$email){
$this->user = $user;
$this->password = $password;
$this->user = $user;
$checking_user = new check($this->db);
if($checking_user->check_user($this->user)) {
throw new Exception('The user exist already');
}else {
$stmt = $this->db->prepare("INSERT INTO USER ( USERNAME,PASSWORD, EMAIL)
VALUES ( '" . mysqli_real_escape_string($this->db,$this->user) . "' , '" . mysqli_real_escape_string($this->db,MD5($this->password)) ."' , '" . mysqli_real_escape_string($this->db,$this->email) ."') ");
$stmt->execute();
}
}
}
Implementacion
Código PHP:
$conexion = new mysqli($dbhost,$dbuser,$dbpassword,$database);
Registry::add('Conexion', $conexion);
$user1 = new user(Registry::get('Conexion'));
$user1->create_user("oliver","oliver","ssdds");
Un saludo maquina!! Espero algun dia poder devolverte el favor jeje