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!

Link to comment
Share on other sites

$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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.