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
Share on other sites

Well i have just tried that method but it is still not working but now it is displaying just the image of images/status_atgate.jpg which is really annying as everything is being entered in the correct format into the database...??? Anybody know?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.