Jump to content

Parse Error Skin blueicev2


Lausitzaircargo

Recommended Posts

Hello Friends,

 

i have installed the blueicev2 skin and all the modules where coming with the file. When i will update my Stats.data.class i will become the following Failure.

 

"Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /www/htdocs/w01501e7/test.lausitz-aircargo.de/core/common/StatsData.class.php on line 879"

 

on this line i have set up the following code from the Documentation 

 

public static function get_stats_by_cur_month($howmany) 	public static function TotalPilotMiles($pilotid)
{
  $key = 'total_miles';
  $key .= '_'.$pilotid;

  $total = CodonCache::read($key);

  if($total === false)
  {
   $total = 0;
   $sql = "SELECT * FROM ".TABLE_PREFIX."pireps WHERE pilotid='$pilotid' AND accepted=1";
   $results = DB::get_results($sql);
   if($results) { foreach($results as $result) { $total += $result->distance; } }

   CodonCache::write($key, $total, '15minute');
  }
  return $total;
}

   public static function getpilotsbestlanding($pilotid)
    {
            $sql = "SELECT landingrate FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' AND landingrate < 0 ORDER BY landingrate DESC LIMIT 1";

            $result = DB::get_row($sql);

            if(!$result)
            {
                return 0;
            }

            $result = $result->landingrate;

        return $result;
    }

        public static function getpilotsworselanding($pilotid)
    {
        $sql = "SELECT landingrate FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' AND landingrate < 0 ORDER BY landingrate ASC LIMIT 1";

            $result = DB::get_row($sql);

            if(!$result)
            {
                return 0;
            }

            $result = $result->landingrate;

        return $result;
}

I´m not the best Coder. So i hope now of help from you Guys.

Link to comment
Share on other sites

The first line there

public static function get_stats_by_cur_month($howmany) 	public static function TotalPilotMiles($pilotid)

shouldn't have two 'public static function' declarations on it. I'm not sure which ones the docs say to use, but you'd have to remove one (maybe remove one, try it and if it doesn't work try the other?). Remember to keep the { on the second line there.

 

Link to comment
Share on other sites

Ignore the post above, wont let me edit it. I forgot to delete something. Edited by moderator....

 

Replace your code with this:

 

public static function TotalPilotMiles($pilotid)
{
  $key = 'total_miles';
  $key .= '_'.$pilotid;

  $total = CodonCache::read($key);

  if($total === false)
  {
   $total = 0;
   $sql = "SELECT * FROM ".TABLE_PREFIX."pireps WHERE pilotid='$pilotid' AND accepted=1";
   $results = DB::get_results($sql);
   if($results) { foreach($results as $result) { $total += $result->distance; } }

   CodonCache::write($key, $total, '15minute');
  }
  return $total;
}

   public static function getpilotsbestlanding($pilotid)
    {
            $sql = "SELECT landingrate FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' AND landingrate < 0 ORDER BY landingrate DESC LIMIT 1";

            $result = DB::get_row($sql);

            if(!$result)
            {
                return 0;
            }

            $result = $result->landingrate;

        return $result;
    }

        public static function getpilotsworselanding($pilotid)
    {
        $sql = "SELECT landingrate FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' AND landingrate < 0 ORDER BY landingrate ASC LIMIT 1";

            $result = DB::get_row($sql);

            if(!$result)
            {
                return 0;
            }

            $result = $result->landingrate;

        return $result;
}

 

Edited by ProAvia
Request of poster
Link to comment
Share on other sites

  • 10 months later...

Fatal error: Cannot redeclare StatsData::TotalPilotMiles() in /home2/premi440/sys.premiercargobrasil.com.br/core/common/StatsData.class.php on line 879

 

 

even replacing all the codes and following steps I couldn't solve this error!

 

Remerson Reis

 

Edited by fnbv
Link to comment
Share on other sites

4 minutes ago, fnbv said:

Fatal error: Cannot redeclare StatsData::TotalPilotMiles() in /home2/premi440/sys.premiercargobrasil.com.br/core/common/StatsData.class.php on line 879

 

 

even replacing all the codes and following steps I couldn't solve this error!

 

Remerson Reis

 

 

Link to comment
Share on other sites

On 3/21/2020 at 1:22 PM, flyalaska said:

Ignore the post above, wont let me edit it. I forgot to delete something. Edited by moderator....

 

Replace your code with this:

 


public static function TotalPilotMiles($pilotid)
{
  $key = 'total_miles';
  $key .= '_'.$pilotid;

  $total = CodonCache::read($key);

  if($total === false)
  {
   $total = 0;
   $sql = "SELECT * FROM ".TABLE_PREFIX."pireps WHERE pilotid='$pilotid' AND accepted=1";
   $results = DB::get_results($sql);
   if($results) { foreach($results as $result) { $total += $result->distance; } }

   CodonCache::write($key, $total, '15minute');
  }
  return $total;
}

   public static function getpilotsbestlanding($pilotid)
    {
            $sql = "SELECT landingrate FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' AND landingrate < 0 ORDER BY landingrate DESC LIMIT 1";

            $result = DB::get_row($sql);

            if(!$result)
            {
                return 0;
            }

            $result = $result->landingrate;

        return $result;
    }

        public static function getpilotsworselanding($pilotid)
    {
        $sql = "SELECT landingrate FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' AND landingrate < 0 ORDER BY landingrate ASC LIMIT 1";

            $result = DB::get_row($sql);

            if(!$result)
            {
                return 0;
            }

            $result = $result->landingrate;

        return $result;
}

 

Fatal error: Cannot redeclare StatsData::TotalPilotMiles() in /home2/premi440/sys.premiercargobrasil.com.br/core/common/StatsData.class.php on line 879

 

 

even replacing all the codes and following steps I couldn't solve this error!

 

Remerson Reis

Link to comment
Share on other sites

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