This question already has an answer here:
- The 3 different equals 8 answers
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