OK so you have 2 tables one for users login and one for the addresses a user
may store and retrieve.

Your users will login, you will validate their name and password combination
and have either a userID or the name is fine too (an integer ID is smaller
to store and possibly more efficient).

Now your PHP script will know the users name and userID (you will be looking
this up  each time they view a page or somehow storing it -- I assume you
know how to do this since this isn't what your were asking about)

So now you can search on your address table however you like but always be
sure to include:
   and authority  = $userID
In your where clause.  Obviously you include other conditions or your users
will get every single entry they ever made.

Just be sure that the insert and update functions will always set the
authority field to the proper userID.  If two users enter the same address
you will have two different records in the address table - identical except
for the authority field.

Easy as pie...

Good Luck,

Frank


On 3/22/02 8:25 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> From: "Ljungan" <[EMAIL PROTECTED]>
> Date: Fri, 22 Mar 2002 18:07:06 +0100
> To: [EMAIL PROTECTED]
> Subject: "marking" DB entries...
> 
> Im making an adressbook using PHP and mySQL.
> I want each user to have access only to his/hers adressinputs. Now Im
> wondering how I gonna solve this, ofcourse its very easy just to create a
> table for each user but then the hole idea of "database" loose its purpose
> =). How can I "mark" each input so that only the specific user who entered
> the information can access it? If two users enters the exact same
> information I want them both to have access to it...
> 
> I was thinking about a table looking like this:
> name CHAR(30),
> adress CHAR(30),
> email CHAR(30),
> phonenumber INT(20),
> authority ENUM()            //--------here is my thought----------
> 
> I was thinking I could save the users name in "authority" and thereby
> marking that this entry was made bye the specific person. Is it possible to
> use this? Please give me a few pointers or better, give me a website where I
> can read about it...
> thanks!
> /Ljungan


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to