MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 22nd, 2004, 12:19 PM
parappa parappa is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 parappa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Restricting Viewable Data

I currently have 2 tables: 1 for users and 1 for jobs. I would like to have a user log in and view only the jobs he or she works/worked with. A job can have several users working with it and a user can work with multiple jobs.

My proposed solution was to add a new database for each user (called Access+username). When a user logs in, that user's access db would be queried and only those jobs would be shown to the user.

Is this an adequate solution or is there an easier way to get the restriction I am looking for? Thanks in advance.

Reply With Quote
  #2  
Old November 22nd, 2004, 12:39 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
You want users to interact with the database directly??
This is strong discouraged!

I'd recommend writing a program that accesses the database for the user.
You have much more control that way.

Reply With Quote
  #3  
Old November 22nd, 2004, 06:50 PM
parappa parappa is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 parappa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No. I want to build a web app that does this. The end result would be a user logging in, and the app displays a list of all that user's jobs. I want to know the most effective way to get the system to show just one user's jobs rather than every job in the system.

Reply With Quote
  #4  
Old November 23rd, 2004, 08:29 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Have you done work already?

How are your tables structured?

Some questions you might want to ask yourself are:
  • Can an employee work on more than one job?
  • Can one job have more than one employee assigned to it?

This is crucial information. If a job will only ever have one employee, you could put a field in the job table relating to the employee table (this would be a foreign key). If an employee will only *ever* have one job, you could put a field in the employee table representing the job they were assigned.

However, most likely, an employee will have many jobs, and one job may have many employees... This is called a Many-To-Many relationship.

The easiest way to deal with many-to-many relationships is to use what's called a bridging table. This table will contain keys joining employees and jobs.

I won't go into detail, in fear that you already know this stuff... but in case you didn't, maybe this will get you started. Feel free to ask questions...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Restricting Viewable Data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT