turkman Posted June 29, 2008 Share Posted June 29, 2008 at the minute my intranet has a basic messaging feature but its just in a table id name subject message. this means all posts are shown even if they are about different topics. If i wanted to give the user a chance to create seperate threads and keep the thread replies seperate, whats the best way to set this up? Does each thread get a seperate table? i.e if someone starts a thread "my new thread" would i need to create a table called it and then put all replies to this thread in that table or is there one way of doing it all in one huge table. i.e postid threadid name subject message then i could fill it like postid threadid name subject message 1 1 joe hello hello all 2 1 max hello hello joe Then thread id would determine which thread each reply belongs too. Whats the standard way of doing this? Thanks. Link to comment https://forums.phpfreaks.com/topic/112452-can-i-get-an-opinion-on-best-way-to-set-up-the-database/ Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 Yes you could do it like that but personally I would create a table called tblThread and a table called tblPost with the following definitions tblThread id, threadTitle,startedDate,updatedDate,userWhoStartedThread tblPost id, threadId, userID, Subject, Message, date Does this make sense? Link to comment https://forums.phpfreaks.com/topic/112452-can-i-get-an-opinion-on-best-way-to-set-up-the-database/#findComment-577356 Share on other sites More sharing options...
turkman Posted June 29, 2008 Author Share Posted June 29, 2008 makes perfect sense. So id just have a start page which shows threads.listed from tblthread using a simple query. Id use this to build the link with GET data in the like i.e showreplys.php?threadid=2 Then in show replies i would take the get data and use that to build my sql query i.e select * from tbl post where threadid = $getdata sort by id DESC right, sorry if this is a silly question im a noob and trying to figure out how this would work, just so its clear in my head before i start. Link to comment https://forums.phpfreaks.com/topic/112452-can-i-get-an-opinion-on-best-way-to-set-up-the-database/#findComment-577363 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 Yes that's totally right! No need to be sorry, we all have these problems when we're starting out Link to comment https://forums.phpfreaks.com/topic/112452-can-i-get-an-opinion-on-best-way-to-set-up-the-database/#findComment-577367 Share on other sites More sharing options...
turkman Posted June 29, 2008 Author Share Posted June 29, 2008 ok great thanks. Now to spend the next 5 hours getting it working :'( Link to comment https://forums.phpfreaks.com/topic/112452-can-i-get-an-opinion-on-best-way-to-set-up-the-database/#findComment-577376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.