-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 23 August 2003 03:25, Shawn wrote:
> It's late, so maybe I'm missing something simple, but here goes...
>
> I have a php file that has this code:
>
>       function getTodaysImages() {

                global $connection;

>               $query = "SELECT * FROM MyTable where date_last_viewed = cast('" .
> date("j F Y") . "' as date);";
>               //echo($query . "<hr>");
>               $result = pg_query($connection, $query) or die("Error in query: 
> $query. "
> . pg_last_error($connection));
>
>               return $result;
>       }
>
> the $connection object is declared in a previous function with the global
> keyword.  My understanding is that it should then be available to
> subsequent functions.  

no, you need to global it in every function you wish to use it in...


- -- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/R1Zt1rcusafx20MRAhdSAJwLriKBSmZBIhhW14rYGSM7ZwbyXACgirFN
lGDJyyMquAkeJG59Q7ZXDUg=
=mCWM
-----END PGP SIGNATURE-----

Reply via email to