0

How to output functions that are stored in mysql database? When I try it the output looks like this:

<-- function();-->

2 Answers 2

3

What have you stored in your table:

function names? or complete functions?

if function names you can do:

$functionname()

if you have complete functions you probably could eval() it.

Please be very very careful with eval().

Why do you store functions in your mysql table? It just looks weird to me.

And perhaps there is a better solution.

Sign up to request clarification or add additional context in comments.

Comments

1

Use the eval() function.

It evaluates a string as PHP code

1 Comment

You can store a whole PHP script in the database. If you use the eval function, you can execute the PHP code. If you don't use the eval function, the stored code will be seen as a string. See php.net/manual/en/function.eval.php for more information. But, as PeeHaa said, be very carefull because eval() can also execute evil code like a Delete Query. So you need to check every value in the Database, so that a user cannot insert a Delete query in it that will be executed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.