View Single Post

  #1 (permalink)  
Old 01-10-2008
reese@adeptscience.com
 
Posts: n/a
Default uh oh, I defined a resoruce

I have been using define to create a constant for the link resource returned by mysql
pconnect like so:

$PL = @mysql_pconnect("localhost", $DBUser, $DBPass);
define("SITE_DB",$PL);


Later I use the constant to select my databases.

mysql_select_db($SrcdbID ,SITE_DB);

This code seems to be working as I expected and I have many thousands of llines of code
done over several years using this construct.

But, I happened to be reading the php doco today and noticed that you are not supposed to
use define for resources, so question is, is what I am doing safe or am I going to run into
problems and if so what is the best way to globally pass resources to multiple classes and
functions, command line scripts etc?


Cheers
Charlie Reese


Reply With Quote