Return to Help Center

Welcome to the Bravenet Help Forums. Here you can chat and meet other Bravenet Members. Please do not post advertisements.

Coding Discussions
This Forum is Locked

Hello. I'm trying to use php and MySQL to create a contact manager. I just need to know how to connect to my database I created on bravehost using php. Here is the function I am using in php to try and connect but, it's failing to connect. I'm new to this so I'm pretty sure I'm just using the wrong commands. Any help would be greatly appreciated. Here is the php code I'm using to access database.

private static function _getConnection() {
static $hDB;

if(isset($hDB)) {
return $hDB;

$hDB = pg_connect("host=servername port=5432 " . "dbname=test_123456 user=testuser password=mypassword")

or die("Failure connecting to the database!");

return $hDB;