Hi everyone,
I'm trying to create a Birthday Script on my site and so far I'm having no luck. All I'm trying to do is create a query that shows todays birthdays - but I would rather try to get the upcoming birthdays for the month.
My first attempt was something like:
$bday = "SELECT `month`, `day` FROM `user` ORDER BY CURDATE()";
$result = mysql_query($bday);
$Members = '';
while($row = mysql_fetch_row($result, MYSQL_ASSOC))
{
$Members .= $row["user"] . '<br>';
}
But for some reason I couldn't even get any response. I left the connection info out - I know it's connecting but my query is wrong.
My DB fields are:
DAY
MONTH
YEAR
these are located in USER
I'm very rusty, as you can see and I'm a little confused about how to get this info... any help would be greatly appreciated!
Again, I'm trying to get the birthdays for this month or even the next 2 weeks?
I've also tried:
$birth = date("m");
$bday = "SELECT * FROM `user` WHERE `month` = '.$birth.'";
$result = mysql_query($bday);
$Members = '';
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$Members .= $row["user"] . '<br>';
}
echo 'Upcoming Birthdays';
echo $Members;