note 16966 deleted from functions by jimw

From: Date: Mon, 10 Dec 2001 23:34:54 +0000
Subject: note 16966 deleted from functions by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22479@lists.php.net to get a copy of this message
For some reason, functions have a serious problem obtaining global accesses to resources, such as databases. $conn = anyPHPdatabaseOpen(...); function useDb() { global $conn; statement_using_connection( $conn ); // The doesn't work, but should. } Because of this, you need to pass the resource (in this case $conn) as a parameter. function useDb( $conn ) { ... }

« previous php.notes (#22479) next »