Another MySQL query question

    Date: 11/16/05 (PHP Community)    Keywords: php, mysql, sql

    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?

    Source: http://www.livejournal.com/community/php/367619.html

« mysql rows || Url location »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home