pdo = $dbpdo; } public function loadSchema($schema_file){ $sql = file_get_contents($schema_file); $this->pdo->exec($sql); } public function insert($registro){ $sql = 'INSERT INTO Registro (nombre,apellido,titulo,afiliacion,ciudad,pais,email,emailzoom,fechaRegistro)' .' VALUES (:nombre,:apellido,:titulo,:afiliacion,:ciudad,:pais,:email,:emailzoom,:fechaRegistro);'; $stmt = $this->pdo->prepare($sql); $stmt->execute([ ':nombre' => $registro['nombre'], ':apellido' => $registro['apellido'], ':titulo' => $registro['titulo'], ':afiliacion' => $registro['afiliacion'], ':ciudad' => $registro['ciudad'], ':pais' => $registro['pais'], ':email' => $registro['email'], ':emailzoom' => $registro['emailzoom'], ':fechaRegistro' => $date = date('Y-m-d H:i:s'), ]); return $this->pdo->lastInsertId(); } public function getAll(){ $stmt = $this->pdo->prepare("SELECT * FROM Registro ORDER BY apellido COLLATE NOCASE ASC"); $stmt -> execute(); return $stmt->fetchAll(\PDO::FETCH_BOTH); } public function findByMail($email){ $stmt = $this->pdo->prepare("SELECT * FROM Registro WHERE email=:email"); $stmt->bindParam(":email",$email); $stmt->execute(); return $result = $stmt->fetch(\PDO::FETCH_ASSOC); } } ?>