It appears you can't pass constant vars by reference, or am I missing your
point? I understand passing vars by reference, but not sure where you
suggest I need to use it. I tried "define('_CONNECT_DB', &$result);" and
"return &_CONNECT_DB;" separately, but neither worked.
> [snip]
> 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;
>
> I call this function this way...
>
> $query = "SELECT * FROM table";
> $connid = connect_db();
> $result = mysql_query($query, $connid);
>
> [/snip]
>
> I think you want to look into pass by reference.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php