lundi 6 juillet 2015

If Statement in PHP Function

I have a function which outputs a variable in a certain color depending on the contents of said variable, however it is currently outputting the same response to the IF statement even if the IF statement is not true

function info($ride) {
    $query = mysql_query("SELECT * FROM `qtd` WHERE `name` = '$ride'");
    $rideinfo = mysql_fetch_array($query);

    $time = $rideinfo["time"];

    if ($time != "Unavailable" || $time != "CLOSED") {
        echo "<center><font color=\"228B22\"><b>$time</b></font></center>";
    }

    if ($time == "Unavailable" || $time == "CLOSED") {
        echo "<center><font color=\"B22222\">$time</font></center>";
    }
}

Currently $time is always being outputted with #228B22 even if the value of $time = "Unavailable" or "CLOSED"

Aucun commentaire:

Enregistrer un commentaire