Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- class databaseConnection {
- protected $db_name = "url";
- protected $db_user = "root";
- protected $db_pass = "";
- protected $db_host = "localhost";
- public function __construct() {
- try {
- parent::__construct("mysql:host={$this->db_host};dbname={$this->db_name}", $this->db_user, $this->db_pass);
- } catch (PDOException $e) {
- echo $e->getMessage();
- }
- }
- }
- $db = new DB;
- $query = $db->prepare('SELECT * FROM users');
- $db->execute();
- print('Jurgen, je kan niks! Hier zijn al je users:');
- $results = $sth->fetchAll();
- print_r($results);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement