RCS Posted July 22, 2008 Share Posted July 22, 2008 OK I am creating a community networking site and I'm hoping someone can help me understand how user sessions work??? Really I just don't understand how you can use more then one table and still have all information in each table attached to that specific user. Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/ Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 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 Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/#findComment-596213 Share on other sites More sharing options...
RCS Posted July 22, 2008 Author Share Posted July 22, 2008 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 Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/#findComment-596225 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 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. Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/#findComment-596229 Share on other sites More sharing options...
RCS Posted July 22, 2008 Author Share Posted July 22, 2008 ok so if I have id as auto increment primary key in all my tables everything will be attached to a specific user the id would be the same in all tables??? is that what you are sayin?? Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/#findComment-596257 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 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. Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/#findComment-596266 Share on other sites More sharing options...
RCS Posted July 22, 2008 Author Share Posted July 22, 2008 Ok I got it thanks for your help Link to comment https://forums.phpfreaks.com/topic/115965-solved-simple-question/#findComment-596272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.