1<?php
2 $db_connection = pg_connect("host=localhost dbname=dbname user=username password=password");
3 $result = pg_query($db_connection, "SELECT lastname FROM employees");
4?>
5<?php // with PDO
6 $myPDO = new PDO('pgsql:host=localhost;dbname=dbname', 'username', 'password');
7 $result = $myPDO->query("SELECT lastname FROM employees");
8?>