bass Posted October 1, 2016 Report Share Posted October 1, 2016 (edited) 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 October 1, 2016 by bass Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 1, 2016 Members Report Share Posted October 1, 2016 (edited) $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 October 1, 2016 by Vangelis 1 Quote Link to comment Share on other sites More sharing options...
bass Posted October 1, 2016 Author Report Share Posted October 1, 2016 $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!) Quote Link to comment Share on other sites More sharing options...
bass Posted October 1, 2016 Author Report Share Posted October 1, 2016 Here is the finished result on my website) Thank you very much for the help, everything works as I wanted. Quote Link to comment Share on other sites More sharing options...
Sava Posted October 1, 2016 Report Share Posted October 1, 2016 Looks great. Where did you get the data from? Quote Link to comment Share on other sites More sharing options...
bass Posted October 1, 2016 Author Report Share Posted October 1, 2016 Looks great. Where did you get the data from? I added two tables 1.Runway 2. This is a table which stores data about the frequencies of the airports. Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 2, 2016 Members Report Share Posted October 2, 2016 You can find them here http://ourairports.com/data/ Quote Link to comment Share on other sites More sharing options...
Sava Posted October 2, 2016 Report Share Posted October 2, 2016 Thaks Vangelis, that's what I was looking for. Quote Link to comment Share on other sites More sharing options...
bass Posted January 18, 2017 Author Report Share Posted January 18, 2017 A small Supplement.Now also shows online vatsim ATC at airports . <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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.