Jump to content

Recommended Posts

Posted

How to list my aircraft of VA in the profile of the pilot? I can not get the code used was the code below! Can someone help me? :( :(

<?php

 foreach($allaircraft as $aircraft)
 {
 if($aircraft->registration == $schedule->registration)
	 $sel = 'selected';
 else
	 $sel = '';

 echo ''.$aircraft->fullname.'';
 }
 ?>

  • Moderators
Posted

Bellow is your code with errors:

<?php
foreach($allaircraft as $aircraft)
{
if($aircraft->registration == $schedule->registration)//($schedule->registration) doesn't exist so this part wouldn't work.
$sel = 'selected';//This is totally useless in the code so you can remove it.
else //The same as above.
$sel = '';//The same as above.

echo ''.$aircraft->fullname.'';// when you want to echo the raw data from Data Base you don't need "." and "'", so remove them.
}
?>

So with corrections the code would be like this:

<?php
$allaircraft = OperationsData::getAllAircraft();//This would be the main feed of your code.
foreach($allaircraft as $aircraft)
{
echo $aircraft->fullname;
}
?>

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