On 6/25/2013 5:46 PM, Fernando A wrote:
Hello,

I am working with php and codeigniter, but I have not yet experienced.
I need create a variable that is available throughout  system.
This variable contains the number of company and can change.
as I can handle this?

Thank you, very much!

Ferd

One way would be to create a file like this:

<?
// company_info.php
$_SESSION['company_name'] = "My Company";
$_SESSION['company_addr1'] = "1 Main St.";
etc.
etc.
etc.

Then - in your startup script (or in every script), use an include statement:

<?php
session_start();
include($path_to_includes."/company_info.php");


Now you will have those SESSION vars available for the entire session, basically until you close your browser.

You can also use the php.ini auto-prepend setting, which automatically does this for you, altho the vars would not be session vars, since the prepend-ed file happens before your script issues the session_start (I think).

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

Reply via email to