doddsey_65 Posted August 9, 2011 Share Posted August 9, 2011 I am working on a notice system which displays notices based on if their conditions have been met, but have run into a problem. The following shows this notice to a user who is logged in and posted more than one post: foreach($row as $key => $val) { $conditions[$key] = unserialize($row[$key]['n_conditions']); if($conditions[$key]['posts_more_than'] && (sessionsClass::$data['u_posts'] > $conditions[$key]['posts_more_than'])) { $notices[] = $row[$key]['n_content']; } but i also have a condition to show notices to users who are logged in whhich is done like so: foreach($row as $key => $val) { $conditions[$key] = unserialize($row[$key]['n_conditions']); if($conditions[$key]['posts_more_than'] && (sessionsClass::$data['u_posts'] > $conditions[$key]['posts_more_than'])) { $notices[] = $row[$key]['n_content']; } elseif($conditions[$key]['logged_in'] == 1 && logged_in(sessionsClass::$data['u_uid'])) { $notices[] = $row[$key]['n_content']; } as you can guess this doesnt work. because the user is logged in it displays both notices regardless of how many posts they have made. Anyone have any ideas on the best method to do this? Link to comment https://forums.phpfreaks.com/topic/244283-display-if-conditions-met/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.