php page to connect to postgresql database code example
Example: php connect to postgresql
<?php
$db_connection = pg_connect("host=localhost dbname=dbname user=username password=password");
$result = pg_query($db_connection, "SELECT lastname FROM employees");
?>
<?php // with PDO
$myPDO = new PDO('pgsql:host=localhost;dbname=dbname', 'username', 'password');
$result = $myPDO->query("SELECT lastname FROM employees");
?>