PDA

View Full Version : Display this birthdays this month


KatieG
03-14-2011, 12:08 AM
Hi

I am trying to display this months birthdays , I have this so far but displays no birthdays this month.. When I know there are,, can anyone help me...:)



$file = "connect.php";
if( file_exists( $file ) ) {
require $file;

$result = mysql_query("SELECT username,birthday FROM user WHERE MONTH(birthday) = MONTH(NOW())");
if( mysql_num_rows( $result ) != 0 ) {
while ( $row = mysql_fetch_array($result)) {


echo $row['username'];
echo "<br />";
echo $row['birthday'];
echo "<br />----------<br />";
}
}else{
echo "No Birthdays<br />This Month";
}

}else{
die("File $file does not exist");
}

Boofo
03-14-2011, 12:40 AM
Have you tried this?

SELECT username,birthday FROM user WHERE MONTH(birthday) = MONTH(CURDATE())