ajout gestion des jeux (ajout, modif, suppr) et maj journal séance 3
This commit is contained in:
@@ -56,6 +56,39 @@ class Game_model extends CI_Model {
|
||||
|
||||
return $query->row_array();
|
||||
}
|
||||
|
||||
public function ajouter_jeu($titre, $annee, $description, $prix) {
|
||||
$donnees = array(
|
||||
'name' => $titre,
|
||||
'releaseYear' => $annee,
|
||||
'shortDescription' => $description,
|
||||
'price' => empty($prix) ? NULL : $prix
|
||||
);
|
||||
return $this->db->insert('game', $donnees);
|
||||
}
|
||||
|
||||
public function supprimer_jeu($id) {
|
||||
return $this->db->delete('game', array('id' => $id));
|
||||
}
|
||||
|
||||
public function get_jeu($id) {
|
||||
$leJeu = $this->db->get_where('game', array('id' => $id));
|
||||
return $leJeu->row_array();
|
||||
}
|
||||
|
||||
public function modifier_jeu($id, $titre, $annee, $description, $prix) {
|
||||
$donnees = array(
|
||||
'name' => $titre,
|
||||
'releaseYear' => $annee,
|
||||
'shortDescription' => $description,
|
||||
'price' => empty($prix) ? NULL : $prix
|
||||
);
|
||||
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->update('game', $donnees);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user