Thanks to all,

What I've come up with in the end (since I want the flexibility of being
able to store the $_SERVER portion or not depending on the need of the
variable) is this:

I retrieve the variable from the database in the following way:

select concatenate('$',name,'=',value,';') as a from variables

I can then eval() that result with no problems.

Cheers,

Michael.

-----Original Message-----
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: 14 August 2002 12:56
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Retrieving variables


You may add "\$_SERVER[DOCUMENT_ROOT].\"/path/to/file\"" to the database 
and then use eval() to evaluate. The better solution is obviously to 
store "/path/to/file" and append it to $_SERVER[DOCUMENT_ROOT] whenever 
you need the full path.

Bogdan

Michael Hazelden wrote:
> Hi all,
> 
> I'm attempting to store variables inside a database and then recall them.
> 
> What I want to do is store them dynamically though - so for instance - a
> path to a file will be stored in the DB as
> $_SERVER[DOCUMENT_ROOT]."/path/to/file"
> 
> But, obviously, when I retrieve this value, it retrieves it as a literal
...
> not much help because I want to parse it as a proper value.
> 
> Is there any way to retrieve that value and then parse it within the PHP
to
> create the "c:/webconsole/path/to/file" string that can be stored within
> another variable?
> 
> Anybody got any thoughts?
> 
> Cheers,
> 
> Michael.
> 
> This message has been checked for all known viruses by the MessageLabs
Virus Control Centre.
> 
>       
> *********************************************************************
> 
> Notice:  This email is confidential and may contain copyright material of
Ocado Limited (the "Company"). Opinions and views expressed in this message
may not necessarily reflect the opinions and views of the Company.
> If you are not the intended recipient, please notify us immediately and
delete all copies of this message. Please note that it is your
responsibility to scan this message for viruses.
> 
> Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY
> 
> *********************************************************************



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


_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.

        
*********************************************************************

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the "Company"). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*********************************************************************

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

Reply via email to