Jump to content

elseif statement error


jfs0479

Recommended Posts

Hi all,

 

I am trying out thid else if statement in my php script and i have entered all of the details manually and in the correct format into the database to test. However each time the script loads, the image says error which is the last else (images/_status_error.jpg). It is really driving me round the best. The other thing is that i have it working superb on my local host and displays the correct message but now it is on someone elses shared host provider it is not working ???

 

Thanks

 

James

 

<?php include("db.php");
					  $nowdate = date('d/m/Y');
					  $query = "SELECT * FROM arab_flights ORDER BY flightid DESC LIMIT 5";
					  $result= mysql_query($query);
					  $timenow = date('H:i:s');
					  //Applying the variables for the extraction
					  while($myrow = mysql_fetch_array($result))

        {

				$flightid = $myrow['flightid'];

				$departing = $myrow['departing'];

				$arriving = $myrow['arriving'];

				$aircraft = $myrow['aircraft'];

				$memberid = $myrow['memberid'];

				$time_startgate = $myrow['time_startgate'];

				$time_starttaxi = $myrow['time_starttaxi'];

				$time_startclimb = $myrow['time_startclimb'];

				$time_startcruise = $myrow['time_startcruise'];

				$time_startapproach = $myrow['time_startapproach'];

				$time_arrivedgate = $myrow['time_arrivedgate'];

				//Working Out Their Status
				if ($timenow >= $time_startgate) {
    $status=('<img src="images/status_atgate.jpg" />'); 
} elseif ($timenow >= $time_starttaxi) {
    $status=('<img src="images/status_taxi.jpg" />');
} elseif ($timenow >= $time_startclimb) {
$status=('<img src="images/status_climbing.jpg" />');
} elseif ($timenow >= $time_startcruise) {
$status=('<img src="images/status_cruise.jpg" />');
} elseif ($timenow >= $time_startapproach) {
$status=('<img src="images/status_approach.jpg" />');
} elseif ($timenow >= $time_arrivedgate) {
$status=('<img src="images/status_arrived.jpg" />');
} else {
    $status=('<img src="images/status_error.jpg" />');
}
$data =("$status");							
                            echo '<td height="28" class="content_table" align="center">' . $flightid . '</td>
                            <td width="143" class="content_table" align="center">' . $departing . '</td>
                            <td width="135" class="content_table" align="center">' . $arriving . '</td>
                            <td width="134" class="content_table" align="center">' . $aircraft . '</td>
                            <td width="102" class="content_table" align="center">' . $memberid . '</td>
                            <td width="149" class="content_table" align="center">' . $data . '</td>';

}

mysql_close() ;
?>

Link to comment
https://forums.phpfreaks.com/topic/58962-elseif-statement-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.