doddsey_65 Posted August 11, 2011 Share Posted August 11, 2011 Ive created a notice system which shows notices to the visitors of my forum. The thing is though I need a system where the logged in user can close the notice and not have it displayed again. What would be the best way to accomplish this? Would cookies be the best idea? Because that would mean setting a cookie for every notice that has been closed.As far as i can think of that's the only way. Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/244460-dont-display-again/ Share on other sites More sharing options...
MasterACE14 Posted August 11, 2011 Share Posted August 11, 2011 store it in the database? Have one of two possible options, and in the notice system check whether it's the first or second option. If first option(default), show notices, otherwise if second option don't show them. Atleast then if they access your site from a different computer they won't have to close the notices again. Quote Link to comment https://forums.phpfreaks.com/topic/244460-dont-display-again/#findComment-1255637 Share on other sites More sharing options...
iStriide Posted August 11, 2011 Share Posted August 11, 2011 You could probably create a table for the notifications and when the user clicks the "close" button it would send the word "hide" or whatever you want to the database so you can use a if statement to hide it. Ex: <?php //When person clicks hide button mysql_query("UPDATE notifications SET notification_type = '$notification_type', user = '$Session_or_Cookie', display = 'hide'") or trigger_error(mysql_error()); //then on the forum $find = "SELECT notification_type, display FROM notifications WHERE user = '$Session_or_Cookie'"; $run = mysql_fetch_assoc(mysql_query($find)) or trigger_error(mysql_error()); $notification = $run['notification_type']; $display = $run['display']; if($display = "hide"){ }else{ echo " $notification "; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/244460-dont-display-again/#findComment-1255639 Share on other sites More sharing options...
teamatomic Posted August 11, 2011 Share Posted August 11, 2011 if you keep you notices in a table then store the ID of closed notices in another table then- when you grab the notices to display use UNIQUE to display only wanted notices HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/244460-dont-display-again/#findComment-1256130 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.