Ok...last posting on this issue, I promise...It is just that I am chasing my tail and need some fresh ideas to solve this issue.....I dynamically fill in the contents of a monthly calendar....the basic idea is that if the date contains an event ($description) then print in for that respective day....else just print the numeric day....the problem is that even if I order the query by description the processing of the array is treated something like this (assuming 4 rows are returned):
calendar cells (days)
rows 1 2 3 4
1 if else else else
2 else if else else
3 else else if else
4 else else else if
so the problem is that everytime after the first row, I get blank rows (one additional for each day on the calendar with a description) because the elses are processed before the if condition is found....
I need the else condition, since it prints out the numeric day, but I obviously only want it to print out once and if the IF condition is not met. I am pulling my hair out...any input would be GREATLY appreciated....
Here is a copy of the query and while function...
global $class_id;
$query = "SELECT * FROM $TableName2 where class_id = '$class_id'";
$result = mysql_query($query, $Link);
$numrows = mysql_num_rows($result);
$cal_date = ($y."-".$m."-".$d);
while ($row) = mysql_fetch_array($result))
{
if (($row['date']==$cal_date))
{
print "<td class='tcell' bgcolor=#CCCCCC valign=\"top\" height=\"100\">$d<br>$row[description]</td>"; break;
}
else
{
print "<td class='tcell' bgcolor=#CCCCCC valign=\"top\" height=\"100\">$d</td>";
}
}