Re: [PHP-DB] marking DB entries...
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 [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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
Re: [PHP-DB] marking DB entries...
thanks for your answer! I already made the login page =). /Ljungan Adam Royle [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 documentation/examples). 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. Adam. 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] marking DB entries...
store and validate a username and password with each user's info -Original Message- From: Ljungan [mailto:[EMAIL PROTECTED]] Sent: Friday, March 22, 2002 11:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] marking DB entries...
well...what the bloody hell are you looking for from us? -Original Message- From: Ljungan [mailto:[EMAIL PROTECTED]] Sent: Friday, March 22, 2002 11:29 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] marking DB entries... well that wasn't very helpful... I have two tables already, users and adressreg ??? /ljungan Rick Emery [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... store and validate a username and password with each user's info -Original Message- From: Ljungan [mailto:[EMAIL PROTECTED]] Sent: Friday, March 22, 2002 11:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] marking DB entries...
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 documentation/examples). 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. Adam. 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
Re: [PHP-DB] marking DB entries...
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