Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class WorkerWithDB
- {
- private $server;
- public function set_server($server)
- {
- $this->server = $server;
- }
- private $password;
- public function set_password($db_password)
- {
- $this->password = $db_password;
- }
- private $user;
- public function set_user($db_user)
- {
- $this->user = $db_user;
- }
- private $name;
- public function set_name($db_name)
- {
- $this->name = $db_name;
- }
- public function __construct()
- {
- $this->set_server("localhost");
- $this->set_user("root");
- $this->set_password("iAHNyIg38WpA34olY79c");
- $this->set_name("magicbuilder");
- }
- private $link;
- private function connect()
- {
- try
- {
- $this->link = new PDO('mysql:host='.$this->host.';dbname='.$this->name, $this->user, $this->password);
- }
- catch (PDOException $e)
- {
- die( 'Ошибка! Всё. Приехали... '.$e->getMessage() );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement