Dawno nic w php nie robiłem, więc tak dla przypomnienia zrobiłem sobie klasę, która łączy się z bazą danych. Mam takie pytanie - czy ja dobrze to zrobiłem? Co ewentualnie proponujecie zmienić?
Ogólnie to jestem w trakcie przesiadki na OOP, więc nie krzyczcie

<?php Class UserInterface { public function SetDBData($_server, $_port, $_username, $_password, $_database); { $this->server = $_server; $this->port = $_port; $this->user = $_username; $this->password = $_password; $this->database = $_database; } public function DBConnect() { Try { $pdo = new PDO('mysql:host='.$this->server.';dbname='.$this->database.';port='.$this->port, $this->username, $this->password ); } catch(PDOException $e) { return "Error! Code ->".$e; } } } $_UI = new UserInterface(); $this->SetDBData("","","",""); $this->DBConnect(); ?>