Image

Imagecrashingwaves38 wrote in Imagephp

Another MySQL query question

The query I have is this:

$query1 = "SELECT DAYOFMONTH(eventdate) as day, DAYOFMONTH(enddate) as endday, event FROM calendar WHERE MONTH(eventdate) = '$month' AND YEAR(eventdate) = '$year' AND type = 1 ORDER BY day";
$result1 = mysql_query($query1) or die('Query failed: please try again ' . mysql_error());

The accompanying result php code I have is this:

while ($a_row = mysql_fetch_array($result1)) {
if ($a_row['enddate'] != '') {
print "< font size=-2>".$a_row['day']." to ".$a_row['endday']." - ".$a_row['event']."< br>< /font>";
}
else {
print "< font size=-2>".$a_row['day']." - ".$a_row['event']."< br>< /font>";
}
}

I get no errors anywhere; it simply only prints the else part and doesn't examine the if part. Is this just the wrong way to go about it? Or am I missing something elementary?