Solved

How to make output display as compiled PHP

Posted on 2014-10-18
5
151 Views
Last Modified: 2014-10-18
I have queried my database and output the field named "code_output". It is my intention for this field to hold html and php. When it displays, the html compiles and displays correctly, but the php does not compile. It literally shows the php code.

In other words, it will output, <table border="1"><tr><td>test</td></tr></table> AS AN ACTUAL TABLE

But when I use, <?php echo "test"; ?>, It doesn't compile, It LITERALLY DISPLAYS <?php echo "test"; ?>

How can I display the query and output as compiled php?

Tis is the simple line of code:
echo $code_output;
0
Comment
Question by:edavo
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40389642
I don't believe that you can.  Since the data that your query returns is Not part of the PHP file, it is simply handled as text.  It is not passed to the PHP interpreter to be 'executed'.
0
 

Author Comment

by:edavo
ID: 40389643
So there's no "simple" way to have an online php editor/tester - like a JS fiddle?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40389656
Right, no "simple" way.  This search https://www.google.com/search?q=php+online+editor will list a number of 'online' PHP editors but "simple" is not what I would call them.  This one http://www.compileonline.com/execute_php_online.php looks interesting.  Since PHP is capable of accessing the files on the server, an application like that has to create a "sandbox" to restrict the operation of PHP to a safe environment that can't damage the server.
0
 

Author Comment

by:edavo
ID: 40389658
Gotcha - thank you very much…
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40389660
You're welcome, glad to help.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question