graham23s Posted May 1, 2007 Share Posted May 1, 2007 Hi Guys, i was going to make a very basic forum users post, view posts etc nothing no where near as technical as this forum , or anything like that my question is, whats the best way to assosciate the logged in user with his post? would i be better grabbing his $id = $_GET['id']; <-- then storing the id in the forum table (to link that user with his posts) CREATE TABLE `forum_posts` ( `id` int(4) NOT NULL auto_increment, `topic` varchar(255) NOT NULL default '', `detail` longtext NOT NULL, `username` varchar(65) NOT NULL default '', `email` varchar(65) NOT NULL default '', `datetime` varchar(25) NOT NULL default '', `view` int(4) NOT NULL default '0', `reply` int(4) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `forum_replies` ( `post_id` int(4) NOT NULL default '0', `reply_id` int(4) NOT NULL default '0', `reply_username` varchar(65) NOT NULL default '', `reply_email` varchar(65) NOT NULL default '', `reply_answer` longtext NOT NULL, `reply_datetime` varchar(25) NOT NULL default '', KEY `reply_id` (`reply_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; thanks for any advice Graham Quote Link to comment Share on other sites More sharing options...
trq Posted May 1, 2007 Share Posted May 1, 2007 would i be better grabbing his $id = $_GET['id']; <-- then storing the id in the forum table (to link that user with his posts) Yes. but as forum posters should be logged in (I assume you'll have a login system?), you can grab it from the $_SESSION array. Also, no need to store the username, email type stuff in with each post, that is what the users table is for. Quote Link to comment Share on other sites More sharing options...
taith Posted May 1, 2007 Share Posted May 1, 2007 in the table, store the id of whoever made it, then on login, set $_SESSION[userid]=$row[id]; thats prolly the easiest way to verify, while not compromizing security that much... Quote Link to comment Share on other sites More sharing options...
graham23s Posted May 1, 2007 Author Share Posted May 1, 2007 Nice one guys thanks for the advice. Graham Quote Link to comment 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.