As far as I know there is no way to set a site-wide global from within a
script.  Use PHP Sessions or set a Cookie and then print the variable in any
script you want by calling $_SESSION['first'] or $COOKIES['first'];.  But
you'll need a starting point for your visitors in order for this to work.

If your visitors will be accessing scripts at random you can do an
include("setfirst.inc"); at the top of each script, where 'setfirst.inc'
accesses the database and sets the $first variable each time a script is
called.

-Kevin

----- Original Message -----
From: "Anna Gyor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 02, 2002 2:06 PM
Subject: [PHP] Global variables


> Hello,
>
> how can I use global variables in my web portal? I have read the php
> documentation, but it works only in the same file.
> I want use more global variable on many php site.
>
> For example:
> In login.php I use the code
>
>          $first=mysql_result($result,0,"FIRST_NAME");
>
> and I want to print this $first variable all of my php site.
>
>
> Thanks!
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to