KatieG
10-07-2012, 05:37 AM
I am trying to display the user birthdays this month
I have done the script below, although there is a birthday set this month
it shows " No Birthdays This Month "
Can anyone help please
<?php
include("connect.php");
$result = mysql_query("SELECT userid,username,birthday FROM user WHERE MONTH(birthday) = MONTH(NOW())");
if( mysql_num_rows( $result ) != 0 ) {
while ( $row = mysql_fetch_array($result))
{
$userid = $user['userid'];
$username = $user['username'];
$birthday = $user['birthday'];
$birthday = explode("-", $birthday);
$birthmonth = $birthday[0];
if ($birthmonth = $month)
{
echo "<a href='member.php?u=$userid'>$username</a>, ";
}
}
}
else{
echo "No Birthdays This Month";
}
?>
I have done the script below, although there is a birthday set this month
it shows " No Birthdays This Month "
Can anyone help please
<?php
include("connect.php");
$result = mysql_query("SELECT userid,username,birthday FROM user WHERE MONTH(birthday) = MONTH(NOW())");
if( mysql_num_rows( $result ) != 0 ) {
while ( $row = mysql_fetch_array($result))
{
$userid = $user['userid'];
$username = $user['username'];
$birthday = $user['birthday'];
$birthday = explode("-", $birthday);
$birthmonth = $birthday[0];
if ($birthmonth = $month)
{
echo "<a href='member.php?u=$userid'>$username</a>, ";
}
}
}
else{
echo "No Birthdays This Month";
}
?>