From: Mulugeta Maru [mailto:[EMAIL PROTECTED]

> Hi Mike,
> 
> I am sorry for the confusion I might have caused. May be it 
> would help to give a clear example.
> 
> Table - Customers (CustomerID, CustomerName, Address, etc)
> 
> Table - Transaction(TransactionID,CustomerID,Date,Amount)
> 
> Note: CustomerID in Customer Table is a Primary Key. 
> TransactionID is a Primary Key and CustomerID is a Foreign 
> Key in Transaction Table).
> 
> Question: How would I be able to give my customers access to 
> the database so that they can update the customer table (for 
> example address change) and add transactions to the 
> transaction table. What I do not want to happen is that
> customer A is able to modify customer B's record. In short 
> how would you restrict customer a to see transactions that 
> pertain to him/her.


As Paul DuBois said earlier, this is something you want to control in your application 
itself. You still haven't specified if you're actually using an application in this 
scenario, so I'm still assuming you're talking about giving the clients access to the 
native mysql client.

Just as your bank gives you a web or executable client with which to access your 
records and transactions, they don't give you access to the database itself.

One example I'm talking about is developing an application for the clients in PHP. It 
would take basic login information and from there keep track of what client it is. At 
that point, you have the CustomerID, so only display to them info pertinent to them 
(SELECT * FROM Customers WHERE CustomerID='$CustomerID'; SELECT * FROM Transaction 
WHERE CustomerID='$CustomerID'), thus only allowing them to update or view records 
/through the web app/ relating to them.

So long as you never select records for Customer B, Customer A will never have the 
ability to view or modify Customer B's records.

Does that make any more sense?


-- 
Mike Johnson
Web Developer
Smarter Living, Inc.
phone (617) 886-5539

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to