PDA

View Full Version : [PHP n MySQL] linking table..??



cokelatdesign
February 21st, 2007, 07:16 PM
hi guys,

I want to make a database driven site with login n password similiar to (my space and friendster)I'm able to set-up new user tp register but when that user signIn again how do I make it so they will directed to their own profile page?

thanks,

bwh2
February 21st, 2007, 07:53 PM
you would probably create a table structure something like:


tbl_users
-----------------
user_id (PK)
user_name
user_email
user_password (store the md5 hash)
date_register

tbl_users_pages
-----------------
user_id (FK, UNIQUE)
... page data columns

some people would suggest just storing the page data in tbl_users. while that method is perfectly fine from a relational db standpoint, i would prefer to have limited activity going for tbl_users. basically i want to protect the data in tbl_users more than tbl_users_pages.

so they would login (which i suggest using the Auth package from PEAR (http://pear.php.net/package/Auth)), then you would just push their user_name or user_id into a query and show the data for them.