Welcome Guest, Not a member yet? Register   Sign In
Loading views from Database??
#2

[eluser]mddd[/eluser]
The include function loads a file and executes it as a php file.
Your print command simple prints out a piece of text. That text happens to contain some things like <?php but is still just text.
If you want to execute a string of text as php, use the eval() function. It takes a string and runs it as php code.

Note: this command will start executing from the start of the string. So if your string contains html, you must first stop php from executing, using ?>.
Also note: if the strings (views) are editable by users, this is extremely dangerous. People could put all kinds of php code in there, and your script will execute it!

My conclusion: don't use views from a database unless there is no other way. It has downsides like security and also it slows the site down because you are loading the data every time you show the page.


Messages In This Thread
Loading views from Database?? - by El Forum - 04-26-2010, 05:12 AM
Loading views from Database?? - by El Forum - 04-26-2010, 05:30 AM
Loading views from Database?? - by El Forum - 04-26-2010, 05:51 AM
Loading views from Database?? - by El Forum - 04-26-2010, 05:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB