emehrkay Posted May 12, 2007 Share Posted May 12, 2007 I have many tables - users, notes, news, etc - each with their own unique id to connect to one another (the usual stuff). I want to add a commenting system to the service. So if someone wants to comment on a news article or a picture etc, it is all contained within one table system. I thought that I would add an 'object' table that is the global unique id master. So if I were to add an user, they would get a user_id and object_id, and likewise for just about anything else that gets inserted into one of the database tables. I figured this would be the cure for the commenting system, you have a comment_id and then you connect it to an object_id. and when the page is generated, a check against the commenting system and object_id would display comments... Does this make sense? Would there be a better way to handle this? If I were to go this route, how large could that object table get - it would be handing out object_id's for N tables? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/51091-what-is-the-practicality-of-using-a-global-unique-id-across-tables/ Share on other sites More sharing options...
cmgmyr Posted May 13, 2007 Share Posted May 13, 2007 Another way you can do it is have your main object table and have that dictate what your sub-table id's are...then you really have 1 unique id to worry about objects: id type 1 user 2 note 3 news 4 user 5 comment users: id name 1 test1 4 test2 notes: id title 2 this is a test and so on... ...hope that makes sense It seems like this would keep you a little more organized and not worrying about more then 1 id. Quote Link to comment https://forums.phpfreaks.com/topic/51091-what-is-the-practicality-of-using-a-global-unique-id-across-tables/#findComment-251727 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.