<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1029833" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1029833</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/recurring-events-mysql#comment-1174282</link>
    <description> &lt;p&gt;Thanks for the quick response.&lt;/p&gt;
&lt;p&gt;Ya sorry i should have been more specific. Im trying to display events that occur once a year like deadlines for contests. So the recurring part would be that the come around next year. And the 6 items thing is just a limit on the  amount of syndication being done by showing which ones are in the near future out of the many entries I put in.&lt;/p&gt;
&lt;p&gt;But what you gave me so far looks good. I will try to mess around with it.&lt;/p&gt;
&lt;p&gt;Thanks again for your help.&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Jul 2005 18:36:24 +0000</pubDate>
 <dc:creator>RenardMF</dc:creator>
 <guid isPermaLink="false">comment 1174282 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/recurring-events-mysql#comment-1174281</link>
    <description> &lt;p&gt;It would really depend on what type of recurring events you are having (repeat every week, every x days, every 3rd monday of the month, etc). Also, what would the likelyhood be of so few events that a recurring item may need to come up twice in the next 6 items. &lt;/p&gt;
&lt;p&gt; As long as you know that the same event wouldn&#039;t show up twice, and you don&#039;t care about past due ones, the script would be fairly easy, have feilds like the following:&lt;/p&gt;
&lt;p&gt;  &lt;strong&gt;eventID&lt;/strong&gt; (autonum int)&lt;br /&gt;
 &lt;strong&gt;   eventDate&lt;/strong&gt; (date)&lt;br /&gt;
 &lt;strong&gt;   eventDesc&lt;/strong&gt; (varchar)&lt;br /&gt;
 &lt;strong&gt;   eventRecNum&lt;/strong&gt; (int)&lt;br /&gt;
 &lt;strong&gt;   eventRecType&lt;/strong&gt; (char)&lt;/p&gt;
&lt;p&gt; If it is recurring, you have values in the RecNum and RecType. The RecType would be a character to indicate type of repeating, like D for days, W for weeks, M for months, etc. &lt;/p&gt;
&lt;p&gt; Examples:&lt;br /&gt;
 eventRecNum = 30, eventRecType = &#039;D&#039; : repeat every 30 days&lt;br /&gt;
 eventRecNum = 1, eventRecType = &#039;M&#039; : repeat every month&lt;br /&gt;
 eventRecNum = 2, eventRecType = &#039;1&#039; : repeat every second monday (0=sunday, 1= monday, 2=tuesday, etc)&lt;br /&gt;
 eventRecNum = -1 eventRecType = &#039;4&#039; : Repeat every last thrusday of the month.&lt;/p&gt;
&lt;p&gt; You could program this however you want, this was just a scheme i came up with right now off the top of my head.&lt;/p&gt;
&lt;p&gt;  At the start of the script, do a &lt;strong&gt;DELETE FROM events WHERE (eventDate &amp;lt; now() AND eventRecNum IS NULL) &lt;/strong&gt;This will delete any old dates that do not repeat. then do a loop of &lt;strong&gt;SELECT * FROM events WHERE eventDate &amp;lt; now()&lt;/strong&gt; (there will only be recurring dates left) Loop though each item, and adjust the date based on when the even will recur. then update the record in the database with the new date.&lt;/p&gt;
&lt;p&gt;  Set this script to run via CRON job during the night.&lt;/p&gt;
&lt;p&gt;  Then on the script to get the dates, you can do &lt;strong&gt;SELECT * FROM EVENTS ORDER BY eventDate LIMIT 6&lt;/strong&gt;. Test this though, not sure if the LIMIT 6 will work right. It may get the first 6 rows and then sort them, But i think it should order all rows then get the first 6. (never used this, so test it).&lt;/p&gt;
&lt;p&gt;  -Greg&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Jul 2005 18:25:42 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1174281 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
