Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('IDataService.php');
- class DataService implements IDataService {
- var $conn;
- public function __construct($host, $user, $pass, $db) {
- $conn = mysqli_connect($host, $user, $pass, $db);
- if(!$conn) {
- throw new Exception("A database connection could not be made.");
- }
- }
- public function GetMovies($id) {
- return $this->conn->query("SELECT * FROM movie WHERE catNo = $id")->fetch_array();
- }
- public function GetCategories() {
- return $this->conn->query("SELECT * FROM category")->fetch_array();
- }
- public function GetCategoryName($id) {
- return $this->conn->query("SELECT catName FROM category WHERE catNo = $id")->fetch_assoc()["catName"];
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement