Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. class dbConnection {
  4.  
  5. protected $db_conn;
  6. public $db_name = 'red_sec_net';
  7. public $db_user = 'root';
  8. public $db_pass = '';
  9. public $db_host = 'localhost';
  10.  
  11. function connect(){
  12. try{
  13. $this->db_conn = new PDO("mysql:host=$this->db_host;dbname=$this->db_name;",$this->db_user,$this->db_pass);
  14. $this->db_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  15. return $this->db_conn;
  16. $this->conn = null;
  17. }catch(PDOException $e){
  18. die('failed to connect to database');
  19. }
  20. }
  21. }
  22.  
  23. ?>
  24.  
  25. Cannot redeclare class dbConnection in C:wamp64wwwredsecclassesclass.database.php on line 3
  26.  
  27. class ManageUsers {
  28.  
  29. public $link;
  30.  
  31. function __construct(){
  32.  
  33. $db_connection = new dbConnection();
  34. $this->link = $db_connection->connect();
  35. return $this->link;
  36. $this->link = null;
  37.  
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement