RE: [PHP-DB] Birthdays!
| From: | John W. Holmes | Date: | Mon, 14 Oct 2002 22:51:32 +0000 |
| Subject: | RE: [PHP-DB] Birthdays! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22394@lists.php.net to get a copy of this message | ||
There has to be a better way than this, but this is what I came up with
before dinner...
$dayofyear = date("z");
$daysinyear = (date("L"))?366:365;
$numover = ($dayofyear + 14) - $daysinyear
if($numover > 0)
{
$sql = "DAYOFYEAR(dob) < $numover AND ";
$twoweeks = $daysinyear;
}
else
{ $twoweeks = $dayofyear + 14; }
$sql .= "DAYOFYEAR(dob) BETWEEN $dayofyear AND $twoweeks";
$result = mysql_query("SELECT * FROM yourtable WHERE $sql");
---John Holmes...
> -----Original Message-----
> From: Steve Vernon [mailto:steve@extremewattage.co.uk]
> Sent: Monday, October 14, 2002 4:20 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Birthdays!
>
> Hiya,
> Just wondering what is the best way to do this please.
>
> I have various birthdays stored as dates including birth years.
>
> Just wondering is there a function, or an easy way to work out the
> birthdays in the next two weeks say. Just be nice on my website to
remind
> me of birthdays.Suppose its simple to work out manually, but then have
to
> mess around with days a month etc.
>
> Thanks,
>
> Steve
> XX