Jump to content

Recommended Posts

  • Moderators
Posted

haviong a quick question curently i use this to see my pilots count

Total Pilots: <?php echo StatsData::PilotCount() ?>

but it will show all active and inactive is there a way to only show how many active pilots there are.

gr joeri

  • Administrators
Posted

I dont see anything that would be easily configured, but you could....

add to StatsData.class.php ->

public static function ActivePilots()   {
                       $query = 'SELECT COUNT(*) AS total
                               FROM '.TABLE_PREFIX.'pilots
                               WHERE retired=0';
                       $result=DB::get_row($query);
                       if (!$result){
                               return '0';
                       }
                       else {
                               return $result->total;
                       }
       }

Then where you want your active pilot count to appear ->

<?php echo StatsData::ActivePilots(); ?>

  • Moderators
Posted

then i get this sadly

Parse error: syntax error, unexpected $end, expecting T_FUNCTION in /home/tntvirtua/domains/tnt-virtual.be/public_html/core/common/StatsData.class.php on line 831

  • Administrators
Posted

You probably need to move the code up inside the last } for the file. It just looks like it is ending the class right before the new section of code. ;)

If that doesnt work, what is line 831?

  • Moderators
Posted

You probably need to move the code up inside the last } for the file. It just looks like it is ending the class right before the new section of code. ;)

If that doesnt work, what is line 831?

that did the job i was deleting the last } my mistake

:(

thanks

  • Moderators
Posted

i just updated to the last beta now the code isnt working annymore

on my frontage main

this one

<?php echo StatsData::ActivePilots(); ?>

  • Administrators
Posted

i just updated to the last beta now the code isnt working annymore

on my frontage main

this one

<?php echo StatsData::ActivePilots(); ?>

Well you added that manually, right?

Just make a new file in /core/common called

CustomData.class.php

and in it put

class CustomData {

// paste your function
}

Then just call it

CustomData::ActivePilots();

  • Moderators
Posted

Joeri, the new piece of code was overwritten when you updated.

negative dave i looked in to it and the code was still there in the statsdata.php i will try what Nabeel sugested wil see iff that is working

thanks all

  • Administrators
Posted

? - statsdata.class.php should have been overwritten when you updated.... Not sure what is going on. A new class would be best anyway, that way it will not get overwritten in future updates.

  • Moderators
Posted

? - statsdata.class.php should have been overwritten when you updated.... Not sure what is going on. A new class would be best anyway, that way it will not get overwritten in future updates.

indeed but i dont upload files that arent new so only updated file u ftp

will make a new claas than

thanks dave and Nabeel

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