Eval() Problem.
Posted: Sat Aug 20, 2011 9:20 am
I am trying to create a simple type of Wiki, one where the control panel is the the database and it has an easy to use interface. The reason I am making it is to distribute a open source project I have been working on, and because of this I need to have a download link. The problem: The script is getting *text* from the database and displaying it, and not the download link.
To fix this I came across eval() however I have run into a problem: The PHP Manual (http://php.net/manual/en/function.eval.php) is not the most descriptive on how to use it I have ever seen.
The code is:
Where $note1text is:
However it errors with:
[text]Parse error: syntax error, unexpected $end in index.php(56) : eval()'d code on line 1[/text]
From reading the PHP page it says something about
[text]eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally. It is not possible to catch a parse error in eval() using set_error_handler(). [/text]
However if I am trying to get it to run the code, how would I use return?
To fix this I came across eval() however I have run into a problem: The PHP Manual (http://php.net/manual/en/function.eval.php) is not the most descriptive on how to use it I have ever seen.
The code is:
Code: Select all
$text = eval('$note1text');Code: Select all
<?php echo "<html><head></head><body><p>Hello There</p></body></html>"; ?>[text]Parse error: syntax error, unexpected $end in index.php(56) : eval()'d code on line 1[/text]
From reading the PHP page it says something about
[text]eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally. It is not possible to catch a parse error in eval() using set_error_handler(). [/text]
However if I am trying to get it to run the code, how would I use return?