Re: RSS Feed

From: Date: Sun, 30 Jan 2011 21:10:38 +0000
Subject: Re: RSS Feed
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-47666@lists.php.net to get a copy of this message
On Sun, Jan 30, 2011 at 2:27 PM, Ron Piggott <ron.piggott@actsministries.org> wrote: > > I have a question about the mySQL query below.  The purpose is to find the last 15 days Bible > reading for an RSS feed. > > In the table each day’s reading is assigned the day # in the year (between 1 and 365).  But > if the query is ran on January 6th, for example, it will only find 6 rows in the result.  Is there > a fancy way to ensure a total of 15 rows are retrieved, even if some of the rows from the end of the > year (days 350 to 365) are being displayed, so it is like a loop?  (I have a record in the table > for day 366 for ‘leap year’ that says the Bible reading starts again tomorrow, for when it is > needed every 4th year) > > Ron > > === > > $day_of_year = getdate(); > > #add 1 because yday starts at 0 > $day_of_year = $day_of_year[yday] + 1; > > $query="SELECT * FROM cè—¥°eR¼ò@ÄV_ë > $database1.friends_of_the_ministry_Bible_reading_plans > WHERE plan =1 AND day <= > $day_of_year ORDER BY day DESC LIMIT 15"; > > === > > The Verse of the Day > “Encouragement from God’s Wordâ€� > http://www.TheVerseOfTheDay.info > Ron, Why not do a mktime for -15 days...that should cover the calendar back into last year www.php.net/mktime -- Bastien Cat, the other other white meat

« previous php.db (#47666) next »