View Single Post
Unread 21 Dec 2005, 00:04   #4
SYMM
Love's Sweet Exile
 
SYMM's Avatar
 
Join Date: May 2001
Location: Living on a Stair (Now Sword-less)
Posts: 2,371
SYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better placeSYMM single handedly makes these forums a better place
Re: Basic PHP Help: Global Variables?

session_start();
at the top of every page, then to set a variable:
$_SESSION['id']=OurID();

and $id=$_SESSION['id'];
to access it,.

the 'global' keyword isn't what you're talking about...

[edit]
re-reading leaves me a buit confused.
The above will alow access to the variable between pages for the length of a session. For access within one page, passing it to any functions that need it is the best way, or if you really insist:
Code:
$id=OurID();
//some code that does things

makeAdvert();

///etc.

function makeAdvert() {
    global $id;
   ///you can use $id here and changes  to itwill persist
}
__________________
--SYMM--
Ba Ba Ti Ki Di Do
SYMM is offline   Reply With Quote