fix the databse
then you dont have to
READ EVERY RECORD IN THE DATABASE
EXPLODE EVERY RECORD
MKTIME
Compare the generated timesatmp and then throw away all records that are not correct
WHAT IF:
you get bigger and there are 2-3 MILLION users at 1/1000 second for each record to make a happy birthday list, plus whatever other user tracking is going on, what are you going to do for the 33minutes - 45minutes your users are waiting for the page to display
$stamp = idate(z,Strtotime($birthday));
if ($stamp >= idate(z) and $stamp < (idate(z)+6)) {echo $nickname;}
for every record in the database
just for the hell of it I put 10000 random records in a database containing nickname and birthday
the sql based query prior took less than 1 second to execute 500 times and extract 500 sets of this weeks birthday
the php query took six seconds to run once and did extract the same three names
on my develpment box which is slower than a server
Fix The Database
in your input processigng you can still input the date as 1985-1-14, but if you explode it above and
or can input birthday as three datebits from drop down selects year month day
$birthday= mktime (0,0,0,$datebits[1],$datebits[2],$datebits[0],0);
and you can fix the table by
update table set birthday = %s , strtotime(birthday);
I havent checked what I just typed as the sql, its probably way wrong, using a php function in sql
but its read the birthday value, parse it to a