Advertisement
Guest User

Untitled

a guest
May 19th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. <?php
  2. function connectDB(){
  3. $conn_string = "host=localhost port=5432 dbname=postgres user=postgres password=29081996";
  4. $conn = pg_connect($conn_string);
  5.  
  6. // Check connection
  7. if (!$conn) {
  8. die("Connection failed: " . pg_last_error());
  9. }
  10.  
  11. $sql = "SET search_path TO tk_basdat";
  12. $result = pg_query($conn, $sql);
  13. if (!$result) {
  14. die("Error in SQL query: " . pg_last_error());
  15. }
  16.  
  17. return $conn;
  18. }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement