RE: [PHP] Confusing Problem
| From: | Martin Towell | Date: | Mon, 21 Jan 2002 01:27:44 +0000 |
| Subject: | RE: [PHP] Confusing Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81303@lists.php.net to get a copy of this message | ||
you'll need to make them global then...
that's one thing that kept getting me when I started using php, global vars
are only global if you tell them to be.... sorta like "local to the global
scope" or something like that :)
-----Original Message-----
From: Tj Corley [mailto:tcorley@theplanet.com]
Sent: Monday, January 21, 2002 10:09 AM
To: DL Neil
Cc: php-general@lists.php.net
Subject: Re: [PHP] Confusing Problem
they are in the same script outside the function.
all the admin functions reside in a admin_func.php
with the $db_host, etc, etc variables assigned before it.
----- Original Message -----
From: "DL Neil" <PHPml@DandE.HomeChoice.co.uk>
To: "Tj Corley" <tcorley@theplanet.com>
Cc: <php-general@lists.php.net>
Sent: Sunday, January 20, 2002 4:56 PM
Subject: Re: [PHP] Confusing Problem
> Tj,
>
>
> > I am really baffled by this problem. I have tried so many things to get
> > this working but to no avail. Here is the
> > actual code:
> >
> > function verify_user($username, $password){
> > $conn = mysql_connect($db_host, $db_user, $db_pass) or
> ...
> > Anyways the problem is I cannot get it to even get to the database. It
> > works when I try to connect in the actual code before I call this
function.
> ...
> > But when I do it that way it won't let me run a query right. I am so
> > baffled. Any input would be appreciated. Thanks.
>
>
> Remember the idea of the "scope" of a variable? (if not, please RTFM)
> Where do the values of $db_host, $db_user, etc come from?
> They are not in the argument list for verify_user().
>
> Regards,
> =dn
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net