Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. // Constant global variables. All stored here for ease.
  3.  
  4. // database values
  5. define("db_host","host=127.0.0.1");
  6. define("db_Port","port=5432");
  7. define("db_Name","dbname=accounting1");
  8. define("db_Credentials","user=websqluser password=Lollipop123");
  9. //--------------------------------------------------------
  10.  
  11. ?>
  12.  
  13.  
  14. <?php
  15. include "inc/globalValues.php";
  16.  
  17. class sqlHelper
  18. {
  19. // On creation of this class, it will open a connetion to the database with the credentials provided in
  20. // inc/globalConsts.php file
  21. public function __construct()
  22. {
  23. $db = pg_connect('$db_Host $db_Port $db_Name $db_Credentials');
  24. if (!$db)
  25. {
  26. echo "Error: Unable to open the db bleh";
  27. }
  28. else
  29. {
  30. echo "Yeah, shits working, go you.";
  31. }
  32. }
  33. }
  34.  
  35. $obj = new sqlHelper;
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement