Guest User

Untitled

a guest
Oct 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. header('Content-Type: text/html; charset=UTF-8');
  2.  
  3. class Sistema {
  4.  
  5. protected $db;
  6.  
  7. protected $total = 0;
  8.  
  9. public function __construct() {
  10.  
  11. }
  12.  
  13. public function dbconnect() {
  14.  
  15. $host_name = 'localhost';
  16. $database = 'mycbs';
  17. $user_name = 'root';
  18. $password = '';
  19.  
  20. $options = array(
  21. MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"
  22. );
  23.  
  24. $pdo = null;
  25. try {
  26. $pdo = new PDO("mysql:host=$host_name; dbname=$database;", $user_name, $password, $options);
  27. $this->db = $pdo;
  28. } catch (PDOException $e) {
  29. echo "Error!: " . $e->getMessage() . "<br/>";
  30. die();
  31. }
  32.  
  33.  
  34.  
  35. }
  36.  
  37. }
  38.  
  39. <meta charset="utf-8" />
Add Comment
Please, Sign In to add comment