Answers for "PHP PostgreSQL connection"

PHP
1

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");
?>
Posted by: Guest on March-20-2021
1

php postgresql

<?php
    $result = pg_query($db_connection, "SELECT lastname FROM employees");
?>
Posted by: Guest on September-01-2020
0

php postgresql

<?php
    $db_connection = pg_connect("host=localhost dbname=DBNAME user=USERNAME password=PASSWORD"); 
?>
Posted by: Guest on September-01-2020

Code answers related to "PHP PostgreSQL connection"

Browse Popular Code Answers by Language