conexion = $db;}public function registrarPeliculas( $id_compañia, $titulo, $idioma){$sql = "INSERT INTO peliculas( id_compañia, titulo, idioma) VALUES(:id_compañia,:titulo,:idioma)";$stmt = $this->conexion->prepare($sql);$stmt->bindParam(':id_compañia', $id_compañia);$stmt->bindParam(':titulo', $titulo);$stmt->bindParam(':idioma', $idioma);return $stmt= $this->execute(PDO::FETCH_ASSOC);}public function obtenerPeliculas($id_peliculas){$sql = "SELECT * FROM peliculas WHERE id_peliculas =:id_peliculas";$stmt = $this->conexion->prepare($sql);$stmt->bindParam(':id_peliculas', $id_peliculas);$stmt->execute();return $stmt->fetch(PDO::FETCH_ASSOC);}public function eliminarPeliculas($id_peliculas){$sql = "DELETE FROM peliculas WHERE id_peliculas =:id_peliculas";$stmt = $this->conexion->prepare($sql);$stmt->bindParam(':id_peliculas', $id_peliculas);return $stmt->execute();}public function actualizarPeliculas( $titulo, $idioma, $id_compañia){$sql = "UPDATE peliculas SET titulo =:titulo, idioma =:idioma, id_compañia =:id_compañia WHERE id_peliculas =:id_peliculas";$stmt = $this->conexion->prepare($sql);$stmt->bindParam(':titulo', $titulo);$stmt->bindParam(':idioma', $idioma);$stmt->bindParam(':id_compañia', $id_compañia);return $stmt->execute();}public function obCompañia(){$sql= $conexion->query("SELECT * FROM peliculas INNER JOIN compañia ON P.id_compañia= C.id_compañia");}public function obtenerCompañia(){$sql = "SELECT * FROM compañia";$stmt = $this->conexion->prepare($sql);$stmt->execute();return $stmt->fetchAll(PDO::FETCH_ASSOC);}}?><?php
class peliculaModel{
private $conexion;
public function __construct($db) {
$this->conexion = $db;
}
public function registrarPeliculas( $id_compañia, $titulo, $idioma){
$sql = "INSERT INTO peliculas ( id_compañia, titulo, idioma) VALUES (:id_compañia, :titulo, :idioma)";
$stmt = $this->conexion->prepare($sql);
$stmt->bindParam(':id_compañia', $id_compañia);
$stmt->bindParam(':titulo', $titulo);
$stmt->bindParam(':idioma', $idioma);
return $stmt= $this->execute(PDO::FETCH_ASSOC);
}
public function obtenerPeliculas($id_peliculas) {
$sql = "SELECT * FROM peliculas WHERE id_peliculas = :id_peliculas";
$stmt = $this->conexion->prepare($sql);
$stmt->bindParam(':id_peliculas', $id_peliculas);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
}
public function eliminarPeliculas($id_peliculas) {
$sql = "DELETE FROM peliculas WHERE id_peliculas = :id_peliculas";
$stmt = $this->conexion->prepare($sql);
$stmt->bindParam(':id_peliculas', $id_peliculas);
return $stmt->execute();
}
public function actualizarPeliculas( $titulo, $idioma, $id_compañia) {
$sql = "UPDATE peliculas SET titulo = :titulo, idioma = :idioma, id_compañia = :id_compañia WHERE id_peliculas = :id_peliculas";
$stmt = $this->conexion->prepare($sql);
$stmt->bindParam(':titulo', $titulo);
$stmt->bindParam(':idioma', $idioma);
$stmt->bindParam(':id_compañia', $id_compañia);
return $stmt->execute();
}
public function obCompañia(){
$sql= $conexion ->query("SELECT * FROM peliculas INNER JOIN compañia ON P.id_compañia= C.id_compañia" );
}
public function obtenerCompañia() {
$sql = "SELECT * FROM compañia";
$stmt = $this->conexion->prepare($sql);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
?>