Jump to content

displaying events under monthly headings from mysql


barniegilly

Recommended Posts

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?

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.