Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Connection {
- public $host;
- public $dbname;
- public $user;
- public $pass;
- public function setHost($host) {
- $this->host = $host;
- }
- public function getHost(){
- return $this->host;
- }
- public function setDbname($host) {
- $this->dbname = $dbname;
- }
- public function setUser($user) {
- $this->user = $user;
- }
- public function getUser(){
- return $this->user;
- }
- public function setPass($pass) {
- $this->pass = $pass;
- }
- }
- $host = new Connection();
- $host->setHost('localhost');
- $dbname = new Connection();
- $dbname->setDbname('almgutec_zeus');
- $user = new Connection();
- $user->setUser('almgutec_zeus');
- $pass = new Connection();
- $pass->setPass('Vp2iXaO7');
- try {
- $conn = new PDO('mysql:host='.$host->getHost.';dbname=almgutec_zeus', $host->getUser, $this->pass);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }
- catch(PDOException $e) {
- echo 'ERROR: ' . $e->getMessage();
- }
- ?>
Add Comment
Please, Sign In to add comment