Jump to content

[SOLVED] function names stored in db; called based on query


lonelytylenol

Recommended Posts

I'm wondering whether something like this is possible:

 

1. I want to store an id# / function-name pair in a database - e.g. 0001 / functionA(), 0002 / functionB(), 0003 / functionC(), etc.

 

2. Based on some query, some number of these id / function name pairs are returned.

 

3. The returned function names are called in a script.

 

More background on my question:

 

I'm building an intranet for my company. There are various departments within my company, each of whom will have their own section of the intranet. I've built various online tools that may be of use to some number of these departments. I want the departments to be able to decide which tools they want to appear on their "home page" within the intranet. In my imagination, each time I create a new tool, I register it in a db table. Each department uses an online form to flag the tools they want to appear on their page. The form they edit updates a db table, linking their department with the id number of the requested tool. The script that creates their home page queries the table, determines the tools they've asked to view on their home page, and calls the appropriate functions that will display these tools.

 

I hope that all makes sense. Thanks!

$array = array ('function1','function2','function2');

$array[0](); //this is now the function1 if you have that

or

$function1=$array[0];

$function1();//this is now the function1 if you have that ;D ;D ;D

 

is that what you mean?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.