levicosta201 Posted February 26, 2013 Report Posted February 26, 2013 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.''; } ?> Quote
freshJet Posted February 26, 2013 Report Posted February 26, 2013 I'm not sure what you're trying to do. $aircraft->fullname won't get you anything. Quote
levicosta201 Posted February 26, 2013 Author Report Posted February 26, 2013 I'm not sure what you're trying to do. $aircraft->fullname won't get you anything. Actually, I'd just like to list my aircraft! But I can not! Quote
Moderators Parkho Posted February 27, 2013 Moderators Report Posted February 27, 2013 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; } ?> Quote
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.