I have done an address book in php, although I kept the 
username/password in with the rest of their details. If you wanted to 
keep it all in two tables, then go ahead. You really should have an ID 
field in every table, whether you use it or not, and most of the times, 
you'll find you will use it. So if you're using two tables, you'll have 
a column in each of them 'linking' up the columns (ie, the same number). 
If you don't know how to do this, there are tons of tutorials on the net 
which gloss over this... (have a look at the mysql 

Then on your actual page, what you should do is have a login page, which 
checks a username/password from a form against the database. At the same 
time, retrieve the ID number where it matches the user/name password and 
put the username and id number in separate session variables.

Once you have the ID number of the person logged in, you can 
allow/disallow what they can edit depending on the ID. If you need 
further help, contact me directly.


> Im making an address book 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

Reply via email to