Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 String from DB into a variable
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Amailer




PostPosted: Wed May 11, 2005 9:26 pm   Post subject: String from DB into a variable

Hey...
Long time since Iv posted here... but anyhow.

I have a table which looks like this:
code:
--------------------------------------------
| variable_name   |    variable_value |
--------------------------------------------
PHP_VER           |   phpversion()
USERNAME          |   $username
--------------------------------------------


Now I want to create a script that takes the variable name from the database and replaces it with its value. Suppose I create a post on my forum and I put {PHP_VER} in my post, I want it to display the phpversion() on my server, how would I go about doing that?

Doing a simple str_replace simply displays the text phpversion() which is not what I want... I want it to 'run the function'...

Any ideas on how I should do this?

Thanks,
Amailer
Sponsor
Sponsor
Sponsor
sponsor
octopi




PostPosted: Wed May 11, 2005 10:43 pm   Post subject: (No subject)

http://ca3.php.net/eval
Amailer




PostPosted: Thu May 12, 2005 6:16 am   Post subject: (No subject)

I knew there was some function out there for this!

Thanks
jrblast




PostPosted: Fri Dec 16, 2005 10:17 pm   Post subject: (No subject)

Is this how BBcodes work?
octopi




PostPosted: Fri Dec 16, 2005 10:39 pm   Post subject: (No subject)

BBcode is just a simple regex search and replace.
I don't have any examples to throw at you, but you can search on google for regex or pcre and php
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: