[solved] A code for the number of pilots currently flying?

I was looking for this code as I want to put a link on the frond page saying: there are 5 xacars flights - click hee to view

Thanks for all the help, james

Use this

there are <?php echo count(ACARSData::GetACARSData());?> xacars flights - click here to view

Thats great! thank you so much!

Use this

there are <?php echo count(ACARSData::GetACARSData());?> xacars flights - click here to view

I was also just thinking, is there anyway to make the text to not show up when there are no xacar flights?

You can assign the count to a variable like

$pilotsflying = count(ACARSData::GetACARSData());

then use an if command to check to see if the count is greater than 0

if($pilotsflying > 0)
  {
     Do Stuff
  }

You can assign the count to a variable like

$pilotsflying = count(ACARSData::GetACARSData());

then use an if command to check to see if the count is greater than 0

if($pilotsflying > 0)
{
Do Stuff
}

I’m not so great with php coding, but where do i put the

if($pilotsflying > 0)
  {
     Do Stuff
  }

? I have tried putting the code all over the place but it doesnt work? one way i did it was this way:

<marquee align="left" direction="left" onmouseover="this.stop();" onmouseout="this.start();" behavior="scroll" width="600"></i>There are <?php echo count(ACARSData::GetACARSData());?> if($pilotsflying > 0)
  {
	<i>currently no</i> }
xacars flights - </i><b>click here to view </b></marquee></

which is wrong as it does not come out There are if($pilotsflying > 0)

{

<i>currently no</i> }

xacars flights - </i><b>click here to view. sorry if this seems like a stupid question:S,

James

try something like this

<?php
   $pilotsflying = count(ACARSData::GetACARSData()); 
       echo '<marquee align="left" direction="left" onmouseover="this.stop();" onmouseout="this.start();" behavior="scroll" width="600">';
       if($pilotsflying > 0)
           { echo 'There are '.$pilotsflying.' xacars flights - click <a href="'.SITE_URL.'/index.php/acars">here</a> to view'; }
           else
           { echo 'Welcome to our site'; }
       echo '</marquee>';
?>

try something like this

<?php $pilotsflying = count(ACARSData::GetACARSData()); echo ''; if($pilotsflying > 0) { echo 'There are '.$pilotsflying.' xacars flights - click here to view'; } else { echo 'Welcome to our site'; } echo ''; ?>

That is brilliant, thank you so much!!

James