Re: Scoping problem
| From: | Nicole Amashta | Date: | Tue, 12 Mar 2002 14:54:24 +0000 |
| Subject: | Re: Scoping problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12592@lists.php.net to get a copy of this message | ||
I have a class that currently will connect to a MySQL and MS SQL database.
It is easy add to this class support for all the other supported databases.
If you would like the code for this class, I will send it to you.
Let me know,
nicole
"Christian Azambuja Pagot" <azambuja@portoweb.com.br> wrote in message
news:3C8DE6D3.FDF4262@portoweb.com.br...
> Hi!!
>
> I am trying to create generic DB functions... (that could connect to
> any kind of database, just with few modifications..)
> I created 2 functions... DB_Connect and DB_Disconnect... and I will
> create another one... DB_Query.
>
> Follows the code:
>
> --------------------------------------------------------------------------
----------------------------
>
> function DB_Connect($dbName)
> {
> static $$dbName;
> $$dbName = mssql_connect ("servername","user","pass");
> }
>
> --------------------------------------------------------------------------
----------------------------
>
> function DB_Disconnect($dbName)
> {
> static $$dbName;
> mssql_close($$dbName);
> }
>
> --------------------------------------------------------------------------
----------------------------
>
> So, in a program, I could do that:
>
> ------------------------------------------------------------------------
>
> DB_Connect("db1");
> DB_Connect("db2");
> .
> .
> .
> .
> DB_Disconnect("db2")
> DB_Disconnect("db1")
>
> ------------------------------------------------------------------------
>
>
> But it is not working... and I don´t know why.. I know that the
> problem is related to the scoping of variables, but I am confused... Did
> you develop something like this already? (I did that in Perl once, and
> it worked perfectly!)
>
> Thankx!!!!
>
> --
> =========================================
> = Christian Azambuja Pagot
> = ------------------------
> = Fones....: (51)9114-7717 / (51)476-4641
> = e-Mail...: AZAMBUJA@portoweb.com.br
> = Chave Publica disponivel
> =========================================
>
> -----BEGIN PGP PUBLIC KEY BLOCK-----
> Version: PGPfreeware 5.5.3i for non-commercial use
> <http://www.pgpi.com>
>
> mQENAzcy1O0AAAEIAKidc5Z07Up3Y9WpH0+S/xN5BQHMVoTMc08Njl92d+hEVclm
> heGNBrfXy04v2BDxeQu64AVXiyOZd16LtRDXEYVonRdvd1qsFPK8fkdxi9iQjPP8
> aJcUM5XY5zndnSTVj4K83nFAcnSwu/IAMXSx+/sQRSpAVtM4JlxAiDdFA8ZEJBXz
> CzzrZWncT9FDlrRFTBKoTqRWbUEIasyVtkHXzo4l2Wc/DzEkg96+hcL21FNDLldW
> VCog47ba9w8XAzpe23kGXIiqSnpodV85BRSjdVwBfFoQyfE64LsYYP+uxPvqduOT
> zJhKzBQO+MtDl+tAlM+Qs0YgPoACvJ8f84z0MNEABRG0M0NocmlzdGlhbiBBemFt
> YnVqYSBQYWdvdCA8YXphbWJ1amFAcG9ydG93ZWIuY29tLmJyPokBFQMFEDcy1O28
> nx/zjPQw0QEBdE4H/iBaJRmOxOGFyTkKM+6PinLaPvsBgvZAOsnW6Cs/QpvJH5mP
> MaCrKxH1EzLj3MVT38bAdmSL+iM/OTMoRWCi7BtcLW8dheOdmt5IVcHx1bQOJ8qe
> hMTn/2/KbvEawDD07OFTerRM+Ac158e/cK5VVC2vFUYuIja2XGD0yJvpndYAoTOe
> 2hSpPf7eCxUGF1CRsmdPMWKIz1fPqUROVxFalxKg0x7XuOjoD/XVNFmBq1j+NtIJ
> idYGjsGSu8s9NF3NaQgvWm9+obaaHhBPzJawZ6pyjCQ19GBi6AuYVpunq2vhzW0G
> ZLqrLPoB0EIzDFylnLY8+fFh84kLykRU1e8/ALw=
> =eTcy
> -----END PGP PUBLIC KEY BLOCK-----
>
>