Jump to content

Querying birthday


BlackIbanez

Recommended Posts

I have 2 fields on my "users" row.

1 is for the birthday (1-31)

1 is for the month (1-12)

 

I'd like to make a birthday query, to show the members with birthdays corresponding a certain day.

I have the following code. But it does not work...

 

<?
$date = getdate();
$day = $date['mday'];
$month = $date['mon'];

$result = mysql_query("SELECT user, birthday, birthmonth FROM users WHERE birthday=$day AND birthmonth=$month");
if(mysql_query($result) != 0) 	{
while($var = mysql_fetch_array($result)) {
$happybday .= "$comma $var[user]";
$comma = ", ";
}
$happybday .= "";
}
?>

 

Any input is appreciated!

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/46029-querying-birthday/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.