Top pilots

<p>Hi.<br />

I want to know how to display top pilots hour in the front page.<br />

i ued this code

<br />
<?php echo TopPilotData::top_pilot_hours($month, $year, 5) ; ?><br />

but it displays nothing. please help.</p>

You will have to state the $month and the $year variables before. In your case the following should work i think:

<?php
$month = date("m");
$year = date("Y");
echo TopPilotData::top_pilot_hours($month, $year, 5) ;

Sorry but that didn’t work also

Where did you place it?

At the frontpage

Close the php tag at the end try to add ?>

Yes i know actually I’m a php pro but the problem is the code is not showing any thing unless it is not working

Please help

TopPilotData::top_pilot_hours($month, $year, 5) ;

This likely gives you an array of the top 5. So i guess that is why you cant echo it.

You need to put it in a foreach loop in order to echo it.

Its just a guess i’m not using the toppilot module.

TopPilotData::top_pilot_hours($month, $year, 5) ;

This likely gives you an array of the top 5. So i guess that is why you cant echo it.

You need to put it in a foreach loop in order to echo it.

Its just a guess i’m not using the toppilot module.

I didn’t get it please explain

Help please!!

You are a php pro, as you stated above, why can’t you understand what Manuel said? It is an array and you have to create a new table and just use foreach to show the data.

Ι hate it when someone expect everything on his plate…

1 Like
<?php echo TopPilotData::top_pilot_hours($month, $year, 5) ; ?>

This code simply returns an array with the information from the database, you need to use it to build a table or list group if that is what you are trying to do. You also need to assign values to the $month and $year variables.

You may just be wanting to link to tthe main page - mysite.com/index.php/toppilot

There are instructions for the module here ->

OK first thank you.

i used this code

<?php
$month = date("m");
$year = date("Y");
$pilot= TopPilotData::top_pilot_hours($month, $year, 1) ;
foreach ($pilot as $top) {
       echo '<tr>';
       echo '<td>'.$top->hours.'</td>';
       echo '</tr>';
   }
?>

but it turns to

PHP Error Message

warning: invalid argument supplied for foreach() in frontpage_main.tpl

plz help

This code

<?php echo TopPilotData::top_pilot_hours($month, $year, 5) ; ?>

is not pulling any records

OK first thank you.

i used this code

<?php $month = date("m"); $year = date("Y"); $pilot= TopPilotData::top_pilot_hours($month, $year, 1) ; foreach ($pilot as $top) { echo ''; echo ''.$top->hours.''; echo ''; } ?>

but it turns to

PHP Error Message

warning: invalid argument supplied for foreach() in frontpage_main.tpl

Have you installed the sql file?

Is there any data in the table?

Does the VA have any flights for the current month?

This code

<?php echo TopPilotData::top_pilot_hours($month, $year, 5) ; ?>

is not pulling any records

Using echo to show that data is not going to work, you need to use the method described in the instructions as you have started to do in the post above.

First thank you Simpilot.

I think that The sql file isn’t installed probably.

also please can u give me the method that pulls the records.

and the foreach gives me invalid argument supplied for foreach()

So please i want the argument supplies for the foreach loop