FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » php/sql design help
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
php/sql design help [message #32704] Sun, 16 July 2006 13:55 Go to next message
esm2002 is currently offline  esm2002   United States
Messages: 339
Registered: May 2002
Location: Atlanta Georgia
Karma: 0
Senior Member
ok, i need some help...

I'm working on a site where I want to use a common set of php scripts but a different set of sql tables for each user. and each user would not have access to nor see the other user information. all the tables for one user would be in a separate mysql database (at least that is my thought).

the user would just login and use (add, update, access) sql tables that i would create just for him. the tables themselves would be the same except for the data in them.

I would appreciate your thoughts on how to implement something like this.

here are mine.

i'm thinking of table names using the user id plus the basic table name. something like

user_one:
user_one_config, user_one_events, user_one_locations,
user_one_equipment

user_two
user_two_config, user_two_events, user_two_locations,
user_two_equipment

user_three
user_three_config, user_three_events,
user_three_locations, user_three_equipment


within view_events.php I could have something like:

$config_table = $user_config_table;
$events_table = $user_events_table;
$locations_table = $user_locations_table;
(although instead of $user_events_table it maybe
something like $_COOKIE['user_acct']. "events". see
below)

how does all this sound?


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Re: php/sql design help [message #32716 is a reply to message #32704] Mon, 17 July 2006 17:22 Go to previous messageGo to next message
satovey is currently offline  satovey   United States
Messages: 3
Registered: July 2006
Karma: 0
Junior Member
esm2002 wrote on Sun, 16 July 2006 09:55

ok, i need some help...

I'm working on a site where I want to use a common set of php scripts but a different set of sql tables for each user. and each user would not have access to nor see the other user information. all the tables for one user would be in a separate mysql database (at least that is my thought).



You will need to make sure that the hosting service
you use gives you an unlimited amount of Sql databases.
Otherwise this will be cost prohibitive.

esm2002 wrote on Sun, 16 July 2006 09:55


the user would just login and use (add, update, access) sql tables that i would create just for him. the tables themselves would be the same except for the data in them.



The table creation can be automated to limit how much
work you need to do.

esm2002 wrote on Sun, 16 July 2006 09:55


I would appreciate your thoughts on how to implement something like this.

here are mine.

i'm thinking of table names using the user id plus the basic table name. something like

user_one:
user_one_config, user_one_events, user_one_locations,
user_one_equipment

user_two
user_two_config, user_two_events, user_two_locations,
user_two_equipment

user_three
user_three_config, user_three_events,
user_three_locations, user_three_equipment


within view_events.php I could have something like:

$config_table = $user_config_table;
$events_table = $user_events_table;
$locations_table = $user_locations_table;
(although instead of $user_events_table it maybe
something like $_COOKIE['user_acct']. "events". see
below)

how does all this sound?


Why would you be assigning different tables to the user?
Are you doing some sort of hosting where this may or
may not be needed?
What information will be placed in the tables?


Scott
Yevotas® Site
Yevotas.biz
Re: php/sql design help [message #33101 is a reply to message #32704] Sat, 12 August 2006 03:34 Go to previous message
Morgwen is currently offline  Morgwen   United States
Messages: 1
Registered: August 2006
Karma: 0
Junior Member
Just a thought...

Would it not be easier to just add a field called UserID.
Then in the add/updates/deletes/etc..... have a line check if the current_user and userid match. If it does, they see the data etc..

select from ...... where userid = user <== something like that?

Just a thought...

Morgwen Cool
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: local time, not server time
Next Topic: php shell execution damn slow on windows
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 04:15:02 GMT 2024

Total time taken to generate the page: 0.02865 seconds