barniegilly Posted August 16, 2011 Share Posted August 16, 2011 Hi I am trying to work out the best way to display my events. I want to display them like this January 2011 Sat 1st Event Title Sun 2nd Event Title February 2011 Mon 3rd Event Title What would be the best way of doing this with a foreach loop or if statement? Quote Link to comment https://forums.phpfreaks.com/topic/244935-displaying-events-under-monthly-headings-from-mysql/ Share on other sites More sharing options...
barniegilly Posted August 16, 2011 Author Share Posted August 16, 2011 The code I already have is as follows <div id="eventlistings"> <ul> <?php $county_dates_set = get_upcomingdatesincounty ($url_countyid); while ($upcomingcountydates = mysql_fetch_array ($county_dates_set)) { ?> <li> <h2><?php echo $upcomingcountydates ['stdate']; ?></h2> </li> <?php $county_events_set = get_eventsforcounty ($url_countyid); while ($countyevents = mysql_fetch_array ($county_events_set)) { if ($countyevents ['stdate'] == $upcomingcountydates ['stdate']) { ?> <div id="event"> <table> <tr> <td id="title"><h1><?php echo $countyevents ['title']; ?> at <?php echo $countyevents ['ven_name']; ?></h1></td> <td><?php echo $upcomingcountydates ['type_description']; ?></td> </tr> <tr> <td><?php echo $countyevents ['org_name']; ?></td> </tr> <tr> <td><ul> <?php $event_dis_set = event_disciplines (); while ($eventdisiplines = mysql_fetch_array ($event_dis_set)){ if ($eventdisiplines ['event_id'] == $countyevents ['event_id']) { ?> <li><img src="images/pink/box.png" width="8" height="8" /> <?php echo $eventdisiplines ['dis_description'];?></li> </ul> <?php } } ?></td> </tr> <tr> <td><?php echo $countyevents ['ass_acronym']; ?> <?php echo $countyevents ['level_description']; ?> For <?php echo $countyevents ['champ_description']; ?></td> <td class="status"><?php echo $countyevents ['status_description']; ?> </td> </tr> </table> </div> <?php } ?> <?php } ?> <?php } ?> </ul> </ul> </div> And that returns the attached screen shot [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/244935-displaying-events-under-monthly-headings-from-mysql/#findComment-1258166 Share on other sites More sharing options...
voip03 Posted August 16, 2011 Share Posted August 16, 2011 like a tree output Quote Link to comment https://forums.phpfreaks.com/topic/244935-displaying-events-under-monthly-headings-from-mysql/#findComment-1258184 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.