0

I have a system for mailing. I want to call the required function from the database, where there is the name for it. eg. I have a mail type "Attendance", I want to call the mail function attendance()(It has the content for monthly attendance to be sent to all employees), from the database as I have many other functions also.

Aamir
  • 16,329
  • 10
  • 59
  • 65
  • If I get you right you want to call a function where the string `Attendance` is the function name which you get from database. So could be a possible duplicate of [How to call PHP function from string stored in a Variable](https://stackoverflow.com/questions/1005857/how-to-call-php-function-from-string-stored-in-a-variable) – caramba Jul 04 '17 at 06:14
  • As a note, executing arbitrary code stored in a database is extremely risky and is best avoided unless you have exhausted all other options. It's better to have the code in your regular PHP code-base, and just the name of a function to execute in the table, referencing it that way instead. – tadman Jul 04 '17 at 06:37
  • I have found the solution with hit and trial. I stored the function name with parameters(like, "a(a,b,c)") and then called it from my php file as, echo $row['a_name']; – Kanika Dawar Jul 04 '17 at 08:42

0 Answers0