Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function connectDB(){
- $conn_string = "host=localhost port=5432 dbname=postgres user=postgres password=29081996";
- $conn = pg_connect($conn_string);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . pg_last_error());
- }
- $sql = "SET search_path TO tk_basdat";
- $result = pg_query($conn, $sql);
- if (!$result) {
- die("Error in SQL query: " . pg_last_error());
- }
- return $conn;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement