Lookup Issue

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
starquest321
User
Posts: 140

Lookup Issue

Post by starquest321 »

I have the following table setup:

index
table_name
fields
users
userid

In table_name I put in the name of a table in my database. I want then based on lookup to get all the fields related to that table so I can select them. How can I do that? I manual type the name of the table in table_name


mobhar
User
Posts: 11905

Post by mobhar »

Your post is not clear enough. An example of use case would be better to understand.

However, this will list all the fields based on the table_name parameter: SELECT fields FROM yourtable WHERE table_name = 'xxx'


starquest321
User
Posts: 140

Post by starquest321 »

My table stores fields which needs to be hidden based on table selected. But I don't know how I can enter a drop down selection of all tables in my database inclluding the views ---> from which I can generate parent child relationship of all fields based on a table. Your suggestion above is good ---> where can I put it?


mobhar
User
Posts: 11905

Post by mobhar »

I suggest you to create the "Master" and "Detail" tables for this. For example:

Master table/view: "table_permissions", which has the field (at least) as follow:

  • table_name

Please note that you can create a View for the master table above using the detail table below which contain only one field by using this SQL: "SELECT DISTINCT table_name FROM field_permissions"

Detail table: "field_permissions", which has the fields (at least) as follow:

  • table_name
  • field_name
  • users
  • userid

So, if you want to manage the which field(s) should be hidden for the certain users, then you can create a Master/Detail relationship for those tables.


Post Reply