Código:
Que le mejorarian a esta clase que hice para conectarme a mysql <?php class Conexion { private $cn; private $rs; public function __construct($serverName = "localhost", $user = "root", $pass = "220785", $db = "sce") { $this->cn = new mysqli($serverName, $user, $pass, $db); } public function dbExecute($query) { $this->rs = $this->cn->query($query); return $this->rs; $this->cerrar(); } public function getInsertedId() { return $this->cn->insert_id; } public function getAffectedRows() { return $this->cn->affected_rows; } private function cerrar(){ return close($this->cn); } } ?>