Let me explain what I'm trying to do...
This is for a call center, and, among other thing, the progam is to track technical support calls. Each tech has their own unique login, and, when logged in, a session object is created w/their info.
The call log has information it pulls out of the database that doesn't change very often, like the problem type (in a dropdown box) and the solutions according to the problem type (also a dropdown box). I was hoping that, instead of using a "SELECT * FROM problemCode" on each page display I could just create a global (or super global from what PHP calls them it seems) array for ALL scripts to see, so there is only one select statement. This way MySQL can use it's time searching through call logs, or things that are actually changing. If the problemCode table is to be updated, then the array would be too.
Is this possible?
from "test1.php", the code
<?php
$GLOBALS['temp'] = "some text";
echo $GLOBALS['temp'];
?>
is fine, but after running that, then runing "test2.php"
<?php
echo $GLOBALS['temp'];
?>
is blank. Does PHP allow 'super global' variables assigned by the user?
Any suggestions, comments, tips, whatever would be greatly appreciated, thanks!
Does PHP support user assigned Superglobal variables?
Moderator: General Moderators
-
levi_501_dehaan
- Forum Newbie
- Posts: 10
- Joined: Mon Oct 14, 2002 4:34 pm
- Location: Glenwood Springs
what im getting here is you want to pass the same variables throught your scripts? if so then
I do believe that you can pass variables using session
ie
$someinfo = "someinformation you want everywhere";
session_register("someinfo");
then on any other page that has session_start(); at the top (probably all your pages if your already using sessions)
you can call your session variable using
$someinfo = $_SESSION["someinfo"];
you can assign stuff to session too without session register
$_SESSION["information"] = "data and stuff";
and call it with
$data = $_SESSION["information"];
try it out and let me know if it works.
-=Levi=-
I do believe that you can pass variables using session
ie
$someinfo = "someinformation you want everywhere";
session_register("someinfo");
then on any other page that has session_start(); at the top (probably all your pages if your already using sessions)
you can call your session variable using
$someinfo = $_SESSION["someinfo"];
you can assign stuff to session too without session register
$_SESSION["information"] = "data and stuff";
and call it with
$data = $_SESSION["information"];
try it out and let me know if it works.
-=Levi=-
I want to pass the same variable througout my scripts for ALL users, where I am using $_SESSION['tech'] as an object w/variables and functions related to the individual tech. All the techs will share some information from the database, like the problem types, and I didn't want to put that in a session object so that there are 50 sessions, and all of them have the same information in them, if that makes sense.
there are several threads related to this subject throughout the board
PHP vs. ASP (global.asa???)
Emulating ASP's Application object with php
global variable in PHP to store users input ???
PHP vs. ASP (global.asa???)
Emulating ASP's Application object with php
global variable in PHP to store users input ???

"I prefer tongue-tied knowledge to ignorant loquacity." - Cicero 55 B.C.
"Say not always what you know, but always know what you say." - Claudius 10 B.C. - 54 A.D.
and there are of course all those excellent tips from lord Polonius
http://the-tech.mit.edu/Shakespeare/hamlet/hamlet.1.3.html