Jump to content

quick question


Txmmy83

Recommended Posts

function countAircraftByICAO($icao){
$sql = "SELECT COUNT(id) AS count FROM phpvms_aircraft WHERE icao='$icao' AND enabled='1'";
$result = DB::get_row($sql);
return $result->count;
}

You can put that in OperationsData.class.php. That will get the count. If you want to display any fields then use this:

function getAircraftByICAO($icao){
$sql = "SELECT * FROM phpvms_aircraft WHERE icao='$icao' AND enabled='1'";
return DB::get_results($sql);
}

Example usage:

<?php
$icao = 'A320';
$count = countAircraftByICAO($icao);
$aircraft = getAircraftByICAO($icao);

echo "There are $count aircraft <br/>";

foreach($aircraft as $item){
echo $item->registration.'<br />';
}
?>

  • Like 1
Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...