123456789101112131415161718192021222324252627282930 |
- <?php
- class ITDeportamentComtroller extends DBProvider {
- private $_connect_db;
- function __construct()
- {
- $this->_connect_db = parent::connect();
- }
- public function get_all(){
- $query = "SELECT * FROM it_deportament;";
- $stmt = $this->_connect_db->prepare($query);
- $stmt->execute();
- return $stmt->fetchAll(PDO::FETCH_CLASS, "ITDeportament");
- }
- public function get_all_by_id(int $id){
- $query = "SELECT * FROM it_deportament WHERE id = :id;";
- $stmt = $this->_connect_db->prepare($query);
- $stmt->bindValue("id", $id, PDO::PARAM_INT);
- $stmt->execute();
- return $stmt->fetchAll(PDO::FETCH_CLASS, "ITDeportament")[0];
- }
- }
- class ITDeportament {
- public $id, $name;
- }
|