lundi 21 novembre 2016

if else not enitrely working [duplicate]

This question already has an answer here:

Got a database that uses the date entered for a bike ride to show a greenlight.gif on another page. If no ride scheduled should alt to redlight.gif. The green light part works. If outside the date>= CURDATE criteria the redlight doesn't. Pulling my hair out on this one!!! Thanks.

<?php

    include('connect.php');

    $result = mysql_query("SELECT event FROM pec_mbbtmssgs WHERE (event='bike' AND date >= CURDATE())") 
              or die(mysql_error());  

    echo "<table border='1' cellpadding='1'>";
    echo "<tr>";
    echo "<td>";

    while($row = mysql_fetch_array( $result )) {
        if ($row['event'] = 'bike') {
            $image = "greenlight";
        } else {
            $image = "redlight";
        }
        echo '<img src=img/' . $image . '.gif />';
    } 

    echo "</tr>";
    echo "</td>";
    echo "</table>";
?>

Aucun commentaire:

Enregistrer un commentaire