jasnjohn
12-04-2003, 08:49 AM
If I wanted to store birthday info about some family and friends so that I could display a message on that particular day of the year, what's the best way to go about it?
I need some simple way of keeping people's info, such as an array, but under the day of year condition, that info needs to be correctly retrieved.
No SQL either, as my server only has one, and I'm using it already.
I used to do it in Javascript, and could copy over the technique to php(javascript goes as follows:
$hb = "Happy Birthday"
$ha = "Happy Anniversary"
if (day == "5" && month == "10")
{print $hb + "the name of the person"}
I can't help but feel it's a little long winded to have so many if statements.
Thanks,
John
I just had a thought, could i add the date(d,m) strings together, and create an array whose elements would be month number and day number eg;
$bday[0130] = "Homer Simpson";
int $doy = date("m").date("d");
print "Happy Birthday ".$bday[$doy];
but how to check if array returns an empty value?
I need some simple way of keeping people's info, such as an array, but under the day of year condition, that info needs to be correctly retrieved.
No SQL either, as my server only has one, and I'm using it already.
I used to do it in Javascript, and could copy over the technique to php(javascript goes as follows:
$hb = "Happy Birthday"
$ha = "Happy Anniversary"
if (day == "5" && month == "10")
{print $hb + "the name of the person"}
I can't help but feel it's a little long winded to have so many if statements.
Thanks,
John
I just had a thought, could i add the date(d,m) strings together, and create an array whose elements would be month number and day number eg;
$bday[0130] = "Homer Simpson";
int $doy = date("m").date("d");
print "Happy Birthday ".$bday[$doy];
but how to check if array returns an empty value?