Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Using a php code stored in database?
Old 06-12-2007, 02:56 PM Using a php code stored in database?
Average Talker

Posts: 23
Name: WHYY
Trades: 0
PHP Code:
$var = "<?php ...php codes here retrieved from database... ?>";
$how_can_I_use_$var_here_as_a_php_code?;
We are able to include a file within the php codes in a php code area. My question is:
"is it possible to use php codes stored in a database in a php area?"
phpost is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-12-2007, 03:13 PM Re: Using a php code stored in database?
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
It most certainly is, you've got to evaluate it with the eval function, but you can't use the <?php tag.

For example:

PHP Code:
eval('echo "test";'); 
Would print test to screen, while

PHP Code:
eval('<?php echo "test"?>');
would give an error.

If you really want to use html in your code however, you can do seomthing like this:
PHP Code:
eval('....php code; ?><p>I\'m a php paragraph!</p><?php ...some more php;');
For more info: http://php.net/eval
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Orodreth; 06-12-2007 at 03:17 PM..
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Old 06-12-2007, 07:59 PM Re: Using a php code stored in database?
Average Talker

Posts: 23
Name: WHYY
Trades: 0
thanks for your quick answer,
the function 'eval(..)' is what I was looking for..
phpost is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Using a php code stored in database?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18986 seconds with 12 queries