Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: SV: RE: Easy question...


Message #1 by "Datatal AB - Gauffin, Jonas" <jonas@d...> on Tue, 5 Nov 2002 17:05:30 +0100
To add yet another opinion, it does no harm to keep the connect() call in the
function.

If a database function requires a database connection, then you should, for
validity's sake, call connect() in every function that makes some query to the
database.

If there is already a connection established, connect() will just return the
existing connection id anyway.


You can only assume that the connection exists if (and only if) you've
performed validity checks on the result from the original call to connect().


For example:

$DB_LINK = connect();

if(!$DB_LINK)
{
   Header('db_problems.html');
}

// rest of script here.



Take care,

Nik


  Return to Index