Select the specific user data from the database
Select the specific user data from the database
am 05.09.2010 13:21:52 von Nagendra Prasad
--0016e64ec1ac126977048f81602a
Content-Type: text/plain; charset=ISO-8859-1
Hi Experts,
I have a mysql database. What I want is that when a user login he can able
to see his entries only, so that he can delete, add or edit his entries
only. I have 2 different tables one for user details and another for actual
entries. Please help me.
Best,
Guru.
--0016e64ec1ac126977048f81602a--
Re: [PHP-DB] Select the specific user data from the database
am 05.09.2010 15:03:55 von Phpster
Then each record needs to have a user filed where their is stored. Then your=
access query just adds an additional filter to check this value
Select * from data_table where user =3D $user
Bastien
Sent from my iPod
On Sep 5, 2010, at 7:21, nagendra prasad wrote:
> Hi Experts,
>=20
> I have a mysql database. What I want is that when a user login he can able=
> to see his entries only, so that he can delete, add or edit his entries
> only. I have 2 different tables one for user details and another for actua=
l
> entries. Please help me.
>=20
> Best,
> Guru.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Select the specific user data from the database
am 05.09.2010 15:03:55 von Phpster
Then each record needs to have a user filed where their is stored. Then your=
access query just adds an additional filter to check this value
Select * from data_table where user =3D $user
Bastien
Sent from my iPod
On Sep 5, 2010, at 7:21, nagendra prasad wrote:
> Hi Experts,
>=20
> I have a mysql database. What I want is that when a user login he can able=
> to see his entries only, so that he can delete, add or edit his entries
> only. I have 2 different tables one for user details and another for actua=
l
> entries. Please help me.
>=20
> Best,
> Guru.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Select the specific user data from the database
am 05.09.2010 15:19:34 von Nagendra Prasad
--001636285152ff1aad048f8304ed
Content-Type: text/plain; charset=ISO-8859-1
PS: Want to check the username from a table and the password from another
table.
Is it possible ??
--001636285152ff1aad048f8304ed--
Re: Select the specific user data from the database
am 05.09.2010 15:19:34 von Nagendra Prasad
--001636285152ff1aad048f8304ed
Content-Type: text/plain; charset=ISO-8859-1
PS: Want to check the username from a table and the password from another
table.
Is it possible ??
--001636285152ff1aad048f8304ed--
Re: Select the specific user data from the database
am 05.09.2010 15:43:19 von Phpster
I would suggest that you keep authorization separate from data access
Bastien
Sent from my iPod
On Sep 5, 2010, at 9:19, nagendra prasad wrote:
> PS: Want to check the username from a table and the password from another t=
able.
>=20
> Is it possible ??
>=20
>=20
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Select the specific user data from the database
am 05.09.2010 15:43:19 von Phpster
I would suggest that you keep authorization separate from data access
Bastien
Sent from my iPod
On Sep 5, 2010, at 9:19, nagendra prasad wrote:
> PS: Want to check the username from a table and the password from another t=
able.
>=20
> Is it possible ??
>=20
>=20
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-WIN] Select the specific user data from the database
am 06.09.2010 11:38:20 von Richard Quadling
On 5 September 2010 12:21, nagendra prasad wrote:
> Hi Experts,
>
> I have a mysql database. What I want is that when a user login he can able
> to see his entries only, so that he can delete, add or edit his entries
> only. I have 2 different tables one for user details and another for actual
> entries. Please help me.
>
> Best,
> Guru.
>
If userA's and userB' data are both in the same table, do or will you
have issues with key fields?
I don't know what the data is, but you would need to include some
element of the user in every unique constraint.
Depending upon the data, another option is to have a separate table or
database per user. This allows for user permissions to be assigned to
the table or database.
I've used this mechanism when users data needs to be sync across
multiple devices and the device initiating the sync was always the
most uptodate. Cloning a table was far easier.
Richard.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-WIN] Select the specific user data from the database
am 06.09.2010 11:38:20 von Richard Quadling
On 5 September 2010 12:21, nagendra prasad wrote:
> Hi Experts,
>
> I have a mysql database. What I want is that when a user login he can able
> to see his entries only, so that he can delete, add or edit his entries
> only. I have 2 different tables one for user details and another for actual
> entries. Please help me.
>
> Best,
> Guru.
>
If userA's and userB' data are both in the same table, do or will you
have issues with key fields?
I don't know what the data is, but you would need to include some
element of the user in every unique constraint.
Depending upon the data, another option is to have a separate table or
database per user. This allows for user permissions to be assigned to
the table or database.
I've used this mechanism when users data needs to be sync across
multiple devices and the device initiating the sync was always the
most uptodate. Cloning a table was far easier.
Richard.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Select the specific user data from the database
am 06.09.2010 13:22:05 von Paul Vatta
You could also try the following approach:
- on the table, have an INSERT trigger add the username to a column
named CREATE_WHO (this can be extended to UPDATE operations too, but
this probably isn't necessary in your example)
- create a view based on "select * from table where CREATE_WHO =
SUBSTRING_INDEX(USER(),'@',1);".
- DML statements are now applied against the view, and not against the
underlying table.
This depends on the user who is logged in to the DB though.
Hope this helps,
Paul
On 6 September 2010 19:38, Richard Quadling wrote:
>
> On 5 September 2010 12:21, nagendra prasad wrote:
> > Hi Experts,
> >
> > I have a mysql database. What I want is that when a user login he can able
> > to see his entries only, so that he can delete, add or edit his entries
> > only. I have 2 different tables one for user details and another for actual
> > entries. Please help me.
> >
> > Best,
> > Guru.
> >
>
> If userA's and userB' data are both in the same table, do or will you
> have issues with key fields?
>
> I don't know what the data is, but you would need to include some
> element of the user in every unique constraint.
>
> Depending upon the data, another option is to have a separate table or
> database per user. This allows for user permissions to be assigned to
> the table or database.
>
> I've used this mechanism when users data needs to be sync across
> multiple devices and the device initiating the sync was always the
> most uptodate. Cloning a table was far easier.
>
> Richard.
>
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Select the specific user data from the database
am 06.09.2010 13:22:05 von Paul Vatta
You could also try the following approach:
- on the table, have an INSERT trigger add the username to a column
named CREATE_WHO (this can be extended to UPDATE operations too, but
this probably isn't necessary in your example)
- create a view based on "select * from table where CREATE_WHO =
SUBSTRING_INDEX(USER(),'@',1);".
- DML statements are now applied against the view, and not against the
underlying table.
This depends on the user who is logged in to the DB though.
Hope this helps,
Paul
On 6 September 2010 19:38, Richard Quadling wrote:
>
> On 5 September 2010 12:21, nagendra prasad wrote:
> > Hi Experts,
> >
> > I have a mysql database. What I want is that when a user login he can able
> > to see his entries only, so that he can delete, add or edit his entries
> > only. I have 2 different tables one for user details and another for actual
> > entries. Please help me.
> >
> > Best,
> > Guru.
> >
>
> If userA's and userB' data are both in the same table, do or will you
> have issues with key fields?
>
> I don't know what the data is, but you would need to include some
> element of the user in every unique constraint.
>
> Depending upon the data, another option is to have a separate table or
> database per user. This allows for user permissions to be assigned to
> the table or database.
>
> I've used this mechanism when users data needs to be sync across
> multiple devices and the device initiating the sync was always the
> most uptodate. Cloning a table was far easier.
>
> Richard.
>
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php