uh oh, I defined a resoruce
| From: | reese at adeptscience dot com | Date: | Thu, 10 Jan 2008 18:33:00 +0000 |
| Subject: | uh oh, I defined a resoruce | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-267034@lists.php.net to get a copy of this message | ||
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