PHP Connections

From: "David Busby" <busby(at)pnts(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Subject: PHP Connections
Date: 2003-08-05 17:44:56
Message-ID: 009601c35b79$48810010$1100000a@busbydev
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

List,
Which way to connect is better for my scripts?

a global
$db = pg_connect('asdfasdfasdfasdf');
and every function can have
global $db;
at the top?

or like this?

function db_handle()
{
return pg_connect('asdfasdfasdfasdfadsf');
}

and everyplace needed use `db_handle()` so I call pg_exec like

$rs = pg_exec(db_handle(),"select everything from everywhere"));

So does that db_handle() make a new connection each time?
I'm really looking for the way to optimise my connection usage.

David Busby
Systems Engineer
busby(at)pnts(dot)com

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Lynna Landstreet 2003-08-05 18:46:21 Re: PHP Connections
Previous Message Lynna Landstreet 2003-08-02 20:21:31 Re: Resultset/array issues