Jump to content

Information about the airport.


bass

Recommended Posts

Hi all. Help create a module.

I added the database table RUNWAYS and try to infer information at the page airport_info.tpl

But displays information only from one line.

For example:

Airport UUDD Moscow has 3 runways, but the screen displays only one(((

<?php
$db = mysql_connect("localhost","xxxx","xxxxx");
mysql_select_db("xxxxx",$db);
?>
<?php
$resultat = mysql_query("SELECT * FROM runways WHERE airport_ident='$name->icao'",$db);
//Выберем вÑе Ð¿Ð¾Ð»Ñ Ð¸Ð· таблицы Runways, где Икао аÑропорта равно к примеру UUDD
$array = mysql_fetch_array($resultat);
echo
"Длина полоÑÑ‹: ".$array['length_ft']."FT<br>
Покрытие: ".$array['surface']."<br>
ПолоÑа: ".$array['he_ident']."<br>
ÐÐºÑ‚Ð¸Ð²Ð½Ð°Ñ Ð¿Ð¾Ð»Ð¾Ñа: ".$array['le_ident'];
?>

https://cloud.mail.r...Kur/99ht97yLs Is the database itself

Edited by bass
Link to comment
Share on other sites

  • Members

$query = "SELECT * FROM runways WHERE airport_ident='$name->icao'";
$Result = DB::get_results($query);
foreach($Result as $a)
{
echo
"Длина полоÑÑ‹: ".$a->length_ft."FT<br>
Покрытие: ".$a->surface."<br>
ПолоÑа: ".$a->he_ident."<br>
ÐÐºÑ‚Ð¸Ð²Ð½Ð°Ñ Ð¿Ð¾Ð»Ð¾Ñа: ".$a->le_ident ;

}

Try this code and replace all other code this code conects to the db via the codon framework

Edited by Vangelis
  • Like 1
Link to comment
Share on other sites

$query = "SELECT * FROM runways WHERE airport_ident='$name->icao'";
$Result = DB::get_results($query);
foreach($Result as $a)
{
echo
"Длина полоÑÑ‹: ".$a->length_ft."FT<br>
Покрытие: ".$a->surface."<br>
ПолоÑа: ".$a->he_ident."<br>
ÐÐºÑ‚Ð¸Ð²Ð½Ð°Ñ Ð¿Ð¾Ð»Ð¾Ñа: ".$a->le_ident ;

}

Try this code and replace all other code this code conects to the db via the codon framework

Super! Thanks, works great!)

Link to comment
Share on other sites

  • 3 months later...

A small Supplement.
Now also shows online vatsim ATC at airports .

2017-01-18_201641.jpg

 

<div class="col-md-3">
<div class="panel panel-primary">
 <div class="panel-heading"> 
 <h3 class="panel-title">ATC в сети</h3> </div> 
<div class="panel-body">
 <?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.vateud.net/online/atc/$name->icao.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
$json=json_decode($response,true); 
?>

<?php 
foreach($json as $row)
{  
 ?>
  <tr>
    <td><?php echo $row['callsign'];?></td><br>
    <td><?php echo $row['frequency'];?></td><br>
    <td><?php echo $row['name'];?></td><br>
  </tr>
  <hr>
<?php
}
?>

</div></div></div>

in airport_info.tpl

 

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