Xml format from php

I am working on a script for a calendar page. The calendar read an xml page and displays the information accordingly.

The xml page is being generated from a mysql database.

I need the xml to be formatted in a specific manner in order for the calendar to work.

Example

<year value=“2007”>
<month value=“04”>
<day value=“12”>
<label>This is posted in calendar square</label>
<description>This is in pop up for that day</description>
</day>
<day value=“13”>
<label>This is posted in calendar square</label>
<description>This is in pop up for that day</description>
</day>
</month>
<month value=“05”>
<day value=“12”>
<label>This is posted in calendar square</label>
<description>This is in pop up for that day</description>
</day>
</month>

Right now I have this working correctly with the exception of it wanting to open and close a month tag for every entry. I am including the current code in hopes somebody can keep me from pulling the rest of my non-white hairs out(not many left).

my current xml out put look like

<year value=“2007”>
<month value=“05”>
<day value=“1”>
<label>Short message</label>
<description>message</description>
</day>
</month>
<month=“05”>
<day value=“21”>
<label>Short message</label>
<description>message</description>
</day>
</month>
<month value=“06”>
<day value=“31”>
<label>Short message</label>
<description>message</description>
</day>
</month>
</year>

basically everything within each tag need to print out before the closing tag.