Jump to content

[SOLVED] Simple Question


RCS

Recommended Posts

About sessions:

Mostly used for storing the user information to login.for example you have a login page, there you have username and password

boxes,when user successfully logged in you store the username in sessions to allow him/her to use authenticated pages with that username.

otherwise send him/her back to login page,if not in session.you can use it for other stuffs also.depends on the nature of website.

 

About more tables:

This is called normalization in database.one table relating to user basic info,the 2nd one relating to his/her access level.just an example.

Also can be applied to more tables.

 

If need any further assistance,can ask freely.

Arif

So I can't use user sessions to attach information in a multiple tables to a specific user???

 

e.g.

I have a user table

In my user table I have all users personal details

username

password

photo

description

address

email

school

...........

 

and I want to also create another table that stores user images, another for guesstbook and so on

how do I make it so that information stored in each table is assigned to that specific user,

can you please explain how that works or show me an example.

 

Thanks in advance

ok.

you have a table users with user info in it.Now good thing is to create primary ID in that table with auto increment.

use that ID in the other tables and also in sessions:

example:

user table,

user_id(primary)

username

password

photo

desc

email

....

...

 

Now in the guestbook table:

user_id

msg

datetime

active

...

...

 

Now user_id will represent separate user in different tables.Now you can store that user user_id to guestbook table when he logged in to that pages,

bcoz the user_id is already in sessions OR username.you can use any one.Upto you.

Hope this helps.

 

Nope.

user_id will increment just in user table,when you create new user.in the other table it will be a reference key to attach specific user to that key.

for example:

user table:

user_id  username  passwords .......

1              test            test ...........

2              like              like ..................

 

Now in guestbook table:

user_id msg datetime .............

1          hi    2008

1        hi to all  2008

2        so so        2009

 

hope this helps.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.