Jump to content

Recommended Posts

What are you trying to do? What you have right now is too jumbled for me to understand. The syntax is wrong.

 

Is there a database field named OK that you want to check? From there if it is equal to 1, you want it to say is in flight, otherwise it has arrived?

Link to comment
https://forums.phpfreaks.com/topic/41030-code-not-working/#findComment-198686
Share on other sites

You would probably do something like this if you are working with a database

<?php
//Connect to Database
$query = "Select * from TABLE"; // I don't know how many flights you have/want to change. This will do all of them. You might want to include a WHERE in the query to select only a specific flight
$result = mysql_query($query) or die(mysql_error()); //Run query
while($row = mysql_fetch_array($result)) //Loop through results
{
       if($row['OK'] == 1) //If OK is equal to one...
       {
              echo "In Flight";
       } else {
              echo $ARRIVEE;
       }
}

Link to comment
https://forums.phpfreaks.com/topic/41030-code-not-working/#findComment-198690
Share on other sites

if ($OK=1) is always true as it is true you have just assigned the value of 1 to the variable OK. Maybe you want ($OK == 1)

 

$query2 = "IF ($OK==1) echo 'In Flight'; else  echo ARRIVE ='$ARRIVEE'";

 

$result2 = mysql_query($query2);

 

but even then $query2 doesn't look like any mysql query I've ever seen.

 

 

Link to comment
https://forums.phpfreaks.com/topic/41030-code-not-working/#findComment-198693
Share on other sites

Hello Chris,

Haven't seen you in a while. Anywho onto the coding:

 

You need to add in table code to the echo so:

while($row = mysql_fetch_array($result)) //Loop through results
{
       if($row['OK'] == 1) //If OK is equal to one...
       {
              $row .= "<tr><td>In Flight</td></tr>";
       } else {
              $row .= '<tr><td>'.$ARRIVEE.'</td></tr>';
       }
}

echo '<table>'.$row.'</table>';

 

Mike

Link to comment
https://forums.phpfreaks.com/topic/41030-code-not-working/#findComment-198805
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.