How can I load dynamic pagecontent from MySQL containing PHP and have that code be evaluated?
-
Hello - I just recently learned PHP and MySQL. I am now in the process of putting together my first page utilizing both of these languages. Currently I have one page, index.php, which takes a page passed by GET and loads the contents of that page from a databse into the body of index. This has been working fine for me until I tried to load a page containing PHP from the database. A page with just HTML or text is loading fine, but when it tries to load PHP from the databse, the PHP is never evaluated. I am figuring this is because PHP already ran and loaded the contents as a string. In order for the PHP to be processed, it would need to make a second pass on the page to get the bodies php. Is there a way I can make PHP execute the code contained in the database that it is loading, rather than just display it as a string?
-
Answer:
Look at http://us3.php.net/eval Say that the variable that has the PHP value in it is $str. Use this: eval("\$str = \"$str\";");
Evan K at Yahoo! Answers Visit the source
Related Q & A:
- How Can I Load Balance Two Wireless Routers?Best solution by Super User
- How can I optimize this dynamic SQL query in oracle with PL/SQL?Best solution by docs.oracle.com
- How can I debug my php code?Best solution by Stack Overflow
- How can I make a dynamic web page in PHP?Best solution by Yahoo! Answers
- How can I load my avatar so that it can show up?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.