pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Busby <busby@pnts.com>
To: pgsql-php@postgresql.org
Subject: PHP Connections
Date: Tue, 5 Aug 2003 10:44:56 -0700
Message-ID: <009601c35b79$48810010$1100000a@busbydev> (raw)

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@pnts.com




view thread (7+ messages)  latest in thread

Message-ID: <009601c35b79$48810010$1100000a@busbydev>
Permalink:  ../009601c35b79$48810010$1100000a@busbydev/
Also on:    postgresql.org/message-id/009601c35b79$48810010$1100000a@busbydev

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: busby@pnts.com
  Subject: Re: PHP Connections
  In-Reply-To: <009601c35b79$48810010$1100000a@busbydev>
  References: <009601c35b79$48810010$1100000a@busbydev>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox