OK, I am sure I have done something wrong in my coding but, for the life of me, I can not figure it out.
I have a MySQL table with the columns:
ID | calmonth | calyear | title | description
I am attempting to display all entries in the dbase on the screen using:
$sql2 = "select * from calendar ORDER BY calyear, calmonth";
echo "<B>CALENDAR LISTING</B><P>";
echo "$message";
echo "
<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#000000\">
<tr bgcolor=white>
<td align=\"center\" nowrap><B>DATE</B></td>
<td align=\"center\" nowrap><B>TITLE</B></td>
<td align=\"center\" nowrap><B>DESCRIPTION</B></td>
<td align=\"center\"><B>FUCTIONS</B></td></tr>
";
$query= mysql_query($sql2) or die (mysql_error());
while($row = mysql_fetch_array($query)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
$displaymonth = date("F", strtotime($calmonth));
$description = nl2br("$description");
echo "<script language=\"JavaScript\" type=\"text/javascript\">
<!--
function remove_$id(){
if (confirm(\"Please confirm you wish to remove\\n\\n$title from your database.\\nOK=Yes - Cancel=No\")){
document.location.href='index.php?action=calendar.list&sub=remove&id=$id'
}}
// -->
</script>
<tr bgcolor=white>
<td align=center nowrap>$displaymonth $calyear</td>
<td align=center>$title</td>
<td align=left>$description</td>
<td align=center nowrap><a href=\"index.php?action=calendar.edit&id=$id\" class=links>EDIT</A> | <a href=\"#\" onClick=\"remove_$id();return false;\" class=links>REMOVE</A></td></tr>
";
$dmonth="";
}
echo "</table>";
For the column 'calmonth' the data is saved as numbers from 01-12.
I currently have two entries in the dbase. One has a calmonth of '03' and the other '04' BUT when the month is formated, they BOTH come out as "March"
Can anyone shed some light on this as to why it is displaying "March" for both BUT it should display "March" for one and "April" for the other?!?!
Thanks in advance for your assistance.