RE: Birthdays!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:  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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux