Re: "marking" DB entries...
| From: | Ljungan | Date: | Sat, 23 Mar 2002 10:17:15 +0000 |
| Subject: | Re: "marking" DB entries... | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-17857@lists.php.net to get a copy of this message | ||
Thanks Frank!
Just to be certain, cant I
< If two users enter the same address
> you will have two different records in the address table - identical
except
> for the authority field.
store the information and just update the authority field? i.e If the are
two fields that look the same (made by user1 and user2) I want them to
become one and just update the authority field so that it would look like
authority="user1,user2". Is that possible or is that to much trouble? I dont
have ANY experience about databases so I dont really know what is most
common to do. But for sure, the sollution you gave me seems very easy,
almost to easy =). I kept thinking about storing in the same field, hehe!
thanks again!
/Ljungan
"Frank Flynn" <frank@declan.com> skrev i meddelandet
news:B8C174E7.57A%frank@declan.com...
> 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, "php-db-digest-help@lists.php.net"
> <php-db-digest-help@lists.php.net> wrote:
>
> > From: "Ljungan" <jens.ljungcrantz@telia.com>
> > Date: Fri, 22 Mar 2002 18:07:06 +0100
> > To: php-db@lists.php.net
> > 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
>