I'm just setting up a database but could use some advice on something I'll be needing to do.
I have a table of users which includes name, email etc, but also a column which indicates whether the user is an admin or a client.
I then will have a (yet unknown) number of tables which follow the exact same structure but have a different name. For example:
A
B
C
When the website I'm building is finished (which will get its information from this database), there is going to be a number of clients who can log in.
Depending on who they are, they might have access to 1 or more of the tables.
For example:
Client 1 should be able to see the table name A and B
Client 2 should be able to see the table name B and C
Client 3 should be able to see the table name A and B and C
I know it's not the best idea to display the actual table names, but I can display them as a list of readable words, rather than db_names_like_this:
$result = mysql_query("SELECT table_name FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = 'database_name'") or die(mysql_error());
while($array=mysql_fetch_row($result))
{
$table_name = str_replace('_',' ',$array[0].'');
echo ucwords($table_name) . '<br />';
}
Question is (finally)...HOW on earth do I set this up? It's possible that in future, a single client could have access to see a list of tens of table names, while another client should only be able to see one table name.
What columns am I going to need to add (and where?) which states "This client can see These table names"
I have no idea how to go forward on this one.
If anyone could give some pointers or hints as to how, I'd be most grateful.
Cheers

New Topic/Question
Reply


MultiQuote




|