SaeDEV2.2/CI3/application/models/Model_site.php

35 lines
883 B
PHP
Raw Normal View History

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Model_site extends CI_MODEL {
public function __construct(){
$this->load->database();
}
public function get_films()
{
$res=$this->db->query("SELECT Film.titre, Film.annee, Film.idFilm,
Film.genre, Artiste.nom, Artiste.prenom
from Film INNER JOIN Artiste
where Film.idMes=Artiste.idArtiste
ORDER by Film.titre
");
return $res->result_array();
}
public function get_fiche($id)
{
$res=$this->db->query("SELECT * from Film INNER JOIN Artiste
where Film.idMes=Artiste.idArtiste AND idFilm=$id");
return $res->row();
}
public function get_actors($id)
{
$res=$this->db->query("SELECT prenom, nom, nomRole from Artiste INNER JOIN Role
where Role.idActeur=Artiste.idArtiste AND Role.idFilm=$id");
return $res->result_array();
}
}