Current location: Hot Scripts Forums » Programming Languages » PHP » Trying to echo PHP code from SQL and run it. And failing.


Trying to echo PHP code from SQL and run it. And failing.

Reply
  #1 (permalink)  
Old 07-31-05, 12:24 PM
Sheldon Sheldon is offline
New Member
 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Trying to echo PHP code from SQL and run it. And failing.

I've just discovered why I can't take PHP code from an SQL record, insert it into the page with 'echo', and not have all the PHP tags sit there on the page bold as brass for all the world to see.

I don't suppose anybody knows a way around this?
Reply With Quote
  #2 (permalink)  
Old 07-31-05, 03:26 PM
drew010 drew010 is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
www.php.net/eval this can execute a string as php code.
Reply With Quote
  #3 (permalink)  
Old 08-01-05, 02:18 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

What do you mean the PHP tags are for everyone to see??? And how do you want to keep PHP scripts in the database? Who is gonna pull them from there to actually execute? Did you ever try to see the page source generated by the PHP script on the browser side (this is what exactly the world sees)?
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
  #4 (permalink)  
Old 08-01-05, 10:35 AM
steveo steveo is offline
Wannabe Coder
 
Join Date: Jun 2004
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Duno if our situations are the same however, when putting full scripts, even simple ones like;
<?php echo 'hello'; ?>
in a mysel database, and echo the output, the output actually looks like;
echo 'hello'; ?>

Therefore it does not execute the code from a MySQL Database. Can this be done, if so how?
Reply With Quote
  #5 (permalink)  
Old 08-01-05, 11:22 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by steveo
Duno if our situations are the same however, when putting full scripts, even simple ones like;
<?php echo 'hello'; ?>
in a mysel database, and echo the output, the output actually looks like;
echo 'hello'; ?>

Therefore it does not execute the code from a MySQL Database. Can this be done, if so how?
If that's the output you're getting for all your scripting, PHP might not even be intalled on the server. All you should be seeing is
Code:
hello
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 07:00 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.