Monday, April 5, 2004, 11:23:29 PM, you wrote: > I am trying to use fewer resources and processes when making database > connections in my scripts, so, upon the first call to make a DB connection, > I store the Link Resource ID in a constant variable that can be accessed by > all other functions that need a DB connection, like this...
> function connect_db() { > if (!defined('_CONNECT_DB')) { > $result = @mysql_pconnect("localhost", "Username", "Password"); > @mysql_select_db("database_name"); > define('_CONNECT_DB', $result); > } > return _CONNECT_DB; <snipped> From: http://www.php.net/manual/en/language.constants.php Only scalar data (boolean, integer, float and string) can be contained in constants. ---------- somewhere in the manual it is said that while a resource or link or some such identifier might look like an integer, it actually isn't. So by extension it is not a scalar value and thus cannot be stored via the means of a define(). Use a 'normal' variable instead. Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php