|
Posted by Gary Hasler on 05/29/07 17:19
peter wrote:
>
> > Newbie warning--I'm ok with PHP but my SQL knowledge is limited.
> > I want to allow our dealers access to our database of price quotes, but
> > only to their own records. The table has a field "dealer", so for
> > example dealer "Joe_Blow" should only be able to read records where that
> > field has that value.
> >
> > Currently I use MS Excel to do a query thru ODBC. I can easily set up a
> > new MySQL user for each dealer with our web site host's "control panel"
> > tools, but cannot set the above mentioned restriction. I could write my
> > own custom PHP interface, but I'm sure this wheel has already been
> > invented, and I would rather not add more pages to our web site. Can
> > someone point me in the right direction?
>
> You simply need to use a where clause in your sql:-
>
> http://dev.mysql.com/doc/refman/5.0/en/select.html so on the end of your sql
> you would have something like WHERE `dealer` = 'Joe_Blow'
Yes, that is what I would do if I were creating a PHP page to show them
the data. What I would greatly prefer is they can simply retrieve data
directly into Excel, say to make a mailing list.
I guess basically I'm asking: is there any way to restrict a mySql user;
or to set a restriction on the table, beyond the built in mySql
restrictions of SELECT, INSERT, etc.
For example: for user Joe_Blow, the restriction "WHERE `dealer` =
'Joe_Blow'" is added to every query? My question is evolving...am I
looking for something like a "middle-man" between the mySql server and
the client?
Navigation:
[Reply to this message]
|