function.php 664 B

123456789101112131415161718192021222324252627
  1. <?php
  2. require_once "../path.php";
  3. class Channal
  4. {
  5. public $dbh;
  6. public function __construct() {
  7. $dns = ""._FILE_DB_CHANNAL_;
  8. $this->dbh = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
  9. $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  10. }
  11. public function getChannal($id){
  12. $query = "SELECT * FROM channal WHERE id= ? ";
  13. $stmt = $this->dbh->prepare($query);
  14. $stmt->execute(array($id));
  15. $channal = $stmt->fetchAll(PDO::FETCH_ASSOC);
  16. if(count($channal)>0){
  17. return $channal[0];
  18. }
  19. else{
  20. return false;
  21. }
  22. }
  23. }
  24. ?>