View Single Post
Old 04-22-2009, 05:15 PM   #1 (permalink)
shankar
The Wanderer
 
Join Date: Apr 2009
Posts: 19
Thanks: 9
shankar is on a distinguished road
Default php mysql month function?!!

I want to create php code to only display user to view only entries from a particular month, can anybody help me!!
this is the code i used; its not working .. can any1 fix it up.

php Code:
$get_month = '01'
$query = "SELECT * FROM stud_attendance WHERE username='$username',month(date)='$get_month'";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) == 0)
{
   header("Location:stud_no_attend.php");
}
else
{

    echo "<table border=1px cellpadding=3 width=430px>";
    while ($row = mysql_fetch_assoc($result))
    {
        echo "<tr>";
        echo "<td>" . $row['date'] . "</td>";
        echo "<td>" . $row['status'] . "&nbsp;&nbsp;</td>";
        echo "<td>" . $row['reason'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
}
__________________
--
Regards
Shankar

Last edited by Wildhoney : 04-22-2009 at 11:28 PM.
shankar is offline  
Reply With Quote