Timer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • scuniverse@gmail.com

    Timer

    I've made a script that is called every hour from a cron web service,
    the problem is that it takes like 50s to execute it and when I run it
    manually (just by putting the url in the browser) it takes less than 1s
    to execute it.

    In this script there's a while loop and for testing proposes I included
    a timer in it to see how much time each loop takes.

    With the web cron service we have
    [1] => 0.042862
    [2] => 0.046418
    [3] => 0.049904
    [4] => 21.338746
    [5] => 21.340762
    [6] => 52.182604
    [7] => 52.738617
    [8] => 52.887804

    Manually we have
    [1] => 0.133298
    [2] => 0.144081
    [3] => 0.152357
    [4] => 0.155286
    [5] => 0.15921
    [6] => 0.162126
    [7] => 0.184527
    [8] => 0.20398

    The jump from the loop 3 to 4 and from 5 to 6 in the web cron is
    constant and happens all the time, when I do it manually I don't see
    anything like that.

    Any ideas why it runs differently if using the web service and doing it
    manually ?

  • Jerry Stuckle

    #2
    Re: Timer

    scuniverse@gmai l.com wrote:[color=blue]
    > I've made a script that is called every hour from a cron web service,
    > the problem is that it takes like 50s to execute it and when I run it
    > manually (just by putting the url in the browser) it takes less than 1s
    > to execute it.
    >
    > In this script there's a while loop and for testing proposes I included
    > a timer in it to see how much time each loop takes.
    >
    > With the web cron service we have
    > [1] => 0.042862
    > [2] => 0.046418
    > [3] => 0.049904
    > [4] => 21.338746
    > [5] => 21.340762
    > [6] => 52.182604
    > [7] => 52.738617
    > [8] => 52.887804
    >
    > Manually we have
    > [1] => 0.133298
    > [2] => 0.144081
    > [3] => 0.152357
    > [4] => 0.155286
    > [5] => 0.15921
    > [6] => 0.162126
    > [7] => 0.184527
    > [8] => 0.20398
    >
    > The jump from the loop 3 to 4 and from 5 to 6 in the web cron is
    > constant and happens all the time, when I do it manually I don't see
    > anything like that.
    >
    > Any ideas why it runs differently if using the web service and doing it
    > manually ?
    >[/color]

    Not without knowing what the script is doing!

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • lorento

      #3
      Re: Timer

      How you cron it?

      Are you using wget? or execute the php script from unix shell?

      I think its better use the wget command instead of running from unix
      shell.

      Regards,

      Lorento
      --



      Comment

      • Jerry Stuckle

        #4
        Re: Timer

        lorento wrote:[color=blue]
        > How you cron it?
        >
        > Are you using wget? or execute the php script from unix shell?
        >
        > I think its better use the wget command instead of running from unix
        > shell.
        >
        > Regards,
        >
        > Lorento
        > --
        > http://www.mastervb.net
        > http://www.immersivelounge.com
        >[/color]

        The same way you set up any other cron - in the Unix shell.

        And yes, you can easily execute a PHP script from the shell - or, in Windows,
        the command line.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • scuniverse@gmail.com

          #5
          Re: Timer

          The script is rather big... there's like 600 lines, however it's quite
          simple.

          At the beggining there's a select mysql query and afterwars a while
          loop, on the loop there's 3 possible cases and each one has 2 select
          and 3 update mysql query, in between the 2 select and 3 updates there's
          a bunch of basic maths and that's pretty much everything.

          When I run it manually it output a lot of division by zero errors but
          no other error

          Comment

          • Metin Savignano

            #6
            Re: Timer

            [color=blue]
            > When I run it manually it output a lot of division by zero errors but
            > no other error[/color]

            Please specify what you mean by "manually": Do you run it in the shell?
            Or do you run it through Apache (i.e. by a page request)?

            If run from the cron: Is it initiated in exactly the same way?

            If you start it manually, do you do this locally or remote?

            Guess: If you get a lot of division by zero errors (which is very
            unclean, BTW), it might be that the script is run with different PHP
            settings. This again may be due to the fact that you start it in
            different ways.

            You might put a phpinfo() in your script and compare the output of both
            ways you start it.

            Just some guesses. We need more info to be more specific.

            Metin

            Comment

            • scuniverse@gmail.com

              #7
              Re: Timer

              When I said manually I meant by a page request, the script is in a
              webserver and I request by putting the URL in the browser and the
              webcron request the same page.

              You said it wasnt clean the warnings about the division by zero so I
              set the error reporting to a lower value (E_ERROR) and it fixed
              everything, now I get the same times on both cases :D I dont really
              understand the why though.

              Comment

              • Metin Savignano

                #8
                Re: Timer

                > When I said manually I meant by a page request, the script is in a[color=blue]
                > webserver and I request by putting the URL in the browser and the
                > webcron request the same page.[/color]

                Does the cron run on the same machine as the web server?
                [color=blue]
                > You said it wasnt clean the warnings about the division by zero so I
                > set the error reporting to a lower value (E_ERROR) and it fixed
                > everything, now I get the same times on both cases :D I dont really
                > understand the why though.[/color]

                Even though this is not what you wanted, it means we get closer to the
                problem. Are you sure the script had run successfully till its end
                before you fixed these problems? Maybe it was canceled early, so it was
                faster because of that...

                Next step would be: Write to a log file every few lines of your script,
                so you can find out where in the script this delay happens, and then
                take a closer a look at it.

                Or post it, and let us take a closer look together.

                Comment

                • Jerry Stuckle

                  #9
                  Re: Timer

                  scuniverse@gmai l.com wrote:[color=blue]
                  > The script is rather big... there's like 600 lines, however it's quite
                  > simple.
                  >
                  > At the beggining there's a select mysql query and afterwars a while
                  > loop, on the loop there's 3 possible cases and each one has 2 select
                  > and 3 update mysql query, in between the 2 select and 3 updates there's
                  > a bunch of basic maths and that's pretty much everything.
                  >
                  > When I run it manually it output a lot of division by zero errors but
                  > no other error
                  >[/color]

                  Well, a lot of division by zero errors tells me there's a lot of sloppy
                  programming there, and anything could be happening.

                  But in addition to that - there is no way anyone can tell you what's going on
                  without detailed knowledge of what you're doing in the loops. I suggest you cut
                  down the amount of code in the slow loops until you locate the specific line(s)
                  of code causing the problem.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Jerry Stuckle

                    #10
                    Re: Timer

                    scuniverse@gmai l.com wrote:[color=blue]
                    > When I said manually I meant by a page request, the script is in a
                    > webserver and I request by putting the URL in the browser and the
                    > webcron request the same page.
                    >
                    > You said it wasnt clean the warnings about the division by zero so I
                    > set the error reporting to a lower value (E_ERROR) and it fixed
                    > everything, now I get the same times on both cases :D I dont really
                    > understand the why though.
                    >[/color]

                    Setting the warnings to a lower value isn't fixing anything. It's just hiding
                    the errors you have. You still have crappy code in there.

                    --
                    =============== ===
                    Remove the "x" from my email address
                    Jerry Stuckle
                    JDS Computer Training Corp.
                    jstucklex@attgl obal.net
                    =============== ===

                    Comment

                    • scuniverse@gmail.com

                      #11
                      Re: Timer

                      Here is part of the code, it's a little long though

                      <?php
                      //Timer
                      function getmicrotime()
                      {
                      list($usec, $sec) = explode(" ", microtime());
                      return((float)$ usec + (float)$sec);
                      }
                      $time_start = getmicrotime();

                      function totaltime($time _start)
                      {
                      $time_end = getmicrotime();
                      return(round(($ time_end - $time_start), 6));
                      }

                      //Code
                      include_once(". ./inc/config.php");
                      error_reporting (E_ERROR);

                      dbConnect("sess ions");
                      $sqlUID = "SELECT ID, Race, Min, Gaz, Size FROM user";
                      $UsersID = mysql_query($sq lUID) or die("Query failed");

                      $i = 1;
                      while ($UserID = mysql_fetch_arr ay($UsersID)) {
                      $UrsID = $UserID['ID'];

                      // Terran
                      if ($UserID['Race'] == 'Terran') {
                      $sqlOBu = "SELECT * FROM units WHERE ID = '$UrsID'";
                      $UserOnB = mysql_query($sq lOBu) or die("Query B failed");
                      $UserONBU = mysql_fetch_arr ay($UserOnB);

                      $sqlBU = "SELECT * FROM build WHERE ID = '$UrsID'";
                      $UserB = mysql_query($sq lBU) or die("Query B failed");
                      $UserBU = mysql_fetch_arr ay($UserB);

                      //units build on the barracks
                      $FACB = $UserONBU[4] + $UserONBU[6] + $UserONBU[8] +
                      $UserONBU[10];
                      //units build on the factory
                      $FACF = $UserONBU[12] + $UserONBU[14] + $UserONBU[16];
                      //Buildings built by the SCV
                      $FACSCV = $UserBU[2] + $UserBU[4] + $UserBU[6] + $UserBU[8] +
                      $UserBU[10] + $UserBU[12] + $UserBU[14] + $UserBU[16] + $UserBU[18] +
                      $UserBU[20];

                      //SCV per tick
                      $SCVPT = $UserBU[1] * 5;
                      //Total SCV built this tick
                      $SCVTA = $UserONBU[2] - $SCVPT;
                      //same as for SCV only for the rest of the units
                      $MarPT = $UserBU[9] * 4.2 * ($UserONBU[6] / $FACB);
                      $MarTA = $UserONBU[6] - $MarPT;
                      $FirPT = $UserBU[9] * 4.2 * ($UserONBU[8] / $FACB);
                      $FirTA = $UserONBU[8] - $FirPT;
                      $GhoPT = $UserBU[9] * 2 * ($UserONBU[10] / $FACB);
                      $GhoTA = $UserONBU[10] - $GhoPT;
                      $VulPT = $UserBU[17] * 3.3 * ($UserONBU[12] / $FACF);
                      $VulTA = $UserONBU[12] - $VulPT;
                      $GolPT = $UserBU[17] * 2.5 * ($UserONBU[14] / $FACF);
                      $GolTA = $UserONBU[14] - $GolPT;
                      $TanPT = $UserBU[17] * 2 * ($UserONBU[16] / $FACF);
                      $TanTA = $UserONBU[16] - $TanPT;


                      //Total SCVs and remaining SCVs to be built
                      if ($SCVTA < 0 or $SCVTA == 0) {
                      $SCVTAD = $UserONBU[2] + $UserONBU[1];
                      $SCVOB = 0;
                      } else {
                      $SCVTAD = $SCVPT + $UserONBU[1];
                      $SCVOB = $SCVTA;
                      }
                      if ($MarTA < 0 or $MarTA == 0) {
                      $MarTAD = $UserONBU[6] + $UserONBU[5];
                      $MarOB = 0;
                      } else {
                      $MarTAD = $MarPT + $UserONBU[5];
                      $MarOB = $MarTA;
                      }
                      if ($FirTA < 0 or $FirTA == 0) {
                      $FirTAD = $UserONBU[8] + $UserONBU[7];
                      $FirOB = 0;
                      } else {
                      $FirTAD = $FirPT + $UserONBU[7];
                      $FirOB = $FirTA;
                      }
                      if ($GhoTA < 0 or $GhoTA == 0) {
                      $GhoTAD = $UserONBU[10] + $UserONBU[9];
                      $GhoOB = 0;
                      } else {
                      $GhoTAD = $GhoPT + $UserONBU[9];
                      $GhoOB = $GhoTA;
                      }
                      if ($MedTA < 0 or $MedTA == 0) {
                      $MedTAD = $UserONBU[3] + $UserONBU[4];
                      $MedOB = 0;
                      } else {
                      $MedTAD = $MedPT + $UserONBU[3];
                      $MedOB = $MedTA;
                      }
                      if ($VulTA < 0 or $VulTA == 0) {
                      $VulTAD = $UserONBU[11] + $UserONBU[12];
                      $VulOB = 0;
                      } else {
                      $VulTAD = $VulPT + $UserONBU[11];
                      $VulOB = $VulTA;
                      }
                      if ($GolTA < 0 or $GolTA == 0) {
                      $GolTAD = $UserONBU[13] + $UserONBU[14];
                      $GolOB = 0;
                      } else {
                      $GolTAD = $GolPT + $UserONBU[13];
                      $GolOB = $GolTA;
                      }
                      if ($TanTA < 0 or $TanTA == 0) {
                      $TanTAD = $UserONBU[15] + $UserONBU[16];
                      $TanOB = 0;
                      } else {
                      $TanTAD = $TanPT + $UserONBU[15];
                      $TanOB = $TanTA;
                      }


                      //Total strenght
                      $Nstrenght = ($UserID['Size'] / 2) + ($UserBU[1] * 2 +
                      $UserBU[3] + $UserBU[5] + $UserBU[7] + $UserBU[9] + $UserBU[11] +
                      $UserBU[13] + $UserBU[15]) + $UserBU[17] + $UserBU[19] + ($UserONBU[1]
                      * 2 + $UserONBU[3] + $UserONBU[5] + $UserONBU[7] + $UserONBU[9] +
                      $UserONBU[11] + $UserONBU[13] + $UserONBU[15]);

                      //calcul of the SCV and command center effect on minerals and
                      gaz gathering
                      $LCC = log10(($UserBU[1] / $UserID['Size']) * 10 + 1);
                      $LSC = log(($UserONBU[1] / $UserID['Size']) + 1, 2);
                      $Fac = $LCC * $LSC * $UserID['Size'] * 100;

                      $NMin = (int)($Fac + $UserID[1]);
                      $NGz = (int)(($Fac / 3) + $UserID[2]);

                      //Automatic increase of land... for now.
                      $NSize = ($UserID['Size'] * 0.01 + 1) + $UserID['Size'];

                      $UpdateOB = mysql_query("UP DATE units SET
                      SCVEd='$SCVTAD' ,SCVIng='$SCVOB ',MarEd='$MarTA D',MarIng='$Mar OB',FireEd='$Fi rTAD',FireIng=' $FirOB'
                      ,GhostEd='$GhoT AD',GhostIng='$ GhoOB',MedEd='$ MedTAD',MedIng= '$MedOB',VulEd= '$VulTAD',VulIn g='$VulOB',GolE d='$GolTAD',Gol Ing='$GolOB'
                      ,TankEd='$TanTA D',TankIng='$Ta nOB' WHERE ID='$UrsID'") or
                      die(mysql_error ());

                      $UpdateBU = mysql_query("UP DATE build SET
                      CCB='$CCoTAD',C COB='$CCoOB',SD B='$DepTAD',SDO B='$DepOB',RefB ='$RefTAD',RefO B='$RefOB',Barr B='$BarTAD',Bar rOB='$BarOB'
                      ,FacB='$FacTAD' ,FacOB='$FacOB' ,EBB='$BayTAD', EBOB='$BayOB',A caB='$AcaTAD',A caOB='$AcaOB',A rmB='$ArmTAD',A rmOB='$ArmOB',S FB='$SciTAD',SF OB='$SciOB'
                      ,BunkB='$BunTAD ',BunkOB='$BunO B' WHERE ID='$UrsID'") or
                      die(mysql_error ());

                      $UpdateMG = mysql_query("UP DATE user SET
                      Min='$NMin',Gaz ='$NGz',NW='$Ns trenght',Size=' $NSize' WHERE
                      ID='$UrsID'") or die(showError(' 3', mysql_error())) ;
                      }



                      I've cut a part on the code but its basically the same thing only for
                      the building where here its just for the units and there's 2 more
                      cases afterwards for 2 other races, the division by zero errors I get
                      them after "//SCV per tick" and every time I divide something by
                      $FACB, this variable is usually not 0, its 0 now cause I'm still
                      testing this, that said I could put a condition there cause there's
                      no point to do that part when $FACB = 0 or $FACF =0.

                      Is it possible that the server slows down the speed of the script for
                      some reason ? seems to me that there's a link between the error
                      messages and the time it takes to run the script, and this only happens
                      with the web cron service and not when I request the url with a browser.

                      Comment

                      • Jerry Stuckle

                        #12
                        Re: Timer

                        scuniverse@gmai l.com wrote:[color=blue]
                        > Here is part of the code, it's a little long though
                        >
                        > <?php
                        > //Timer
                        > function getmicrotime()
                        > {
                        > list($usec, $sec) = explode(" ", microtime());
                        > return((float)$ usec + (float)$sec);
                        > }
                        > $time_start = getmicrotime();
                        >
                        > function totaltime($time _start)
                        > {
                        > $time_end = getmicrotime();
                        > return(round(($ time_end - $time_start), 6));
                        > }
                        >
                        > //Code
                        > include_once(". ./inc/config.php");
                        > error_reporting (E_ERROR);
                        >
                        > dbConnect("sess ions");
                        > $sqlUID = "SELECT ID, Race, Min, Gaz, Size FROM user";
                        > $UsersID = mysql_query($sq lUID) or die("Query failed");
                        >
                        > $i = 1;
                        > while ($UserID = mysql_fetch_arr ay($UsersID)) {
                        > $UrsID = $UserID['ID'];
                        >
                        > // Terran
                        > if ($UserID['Race'] == 'Terran') {
                        > $sqlOBu = "SELECT * FROM units WHERE ID = '$UrsID'";
                        > $UserOnB = mysql_query($sq lOBu) or die("Query B failed");
                        > $UserONBU = mysql_fetch_arr ay($UserOnB);
                        >
                        > $sqlBU = "SELECT * FROM build WHERE ID = '$UrsID'";
                        > $UserB = mysql_query($sq lBU) or die("Query B failed");
                        > $UserBU = mysql_fetch_arr ay($UserB);
                        >
                        > //units build on the barracks
                        > $FACB = $UserONBU[4] + $UserONBU[6] + $UserONBU[8] +
                        > $UserONBU[10];
                        > //units build on the factory
                        > $FACF = $UserONBU[12] + $UserONBU[14] + $UserONBU[16];
                        > //Buildings built by the SCV
                        > $FACSCV = $UserBU[2] + $UserBU[4] + $UserBU[6] + $UserBU[8] +
                        > $UserBU[10] + $UserBU[12] + $UserBU[14] + $UserBU[16] + $UserBU[18] +
                        > $UserBU[20];
                        >
                        > //SCV per tick
                        > $SCVPT = $UserBU[1] * 5;
                        > //Total SCV built this tick
                        > $SCVTA = $UserONBU[2] - $SCVPT;
                        > //same as for SCV only for the rest of the units
                        > $MarPT = $UserBU[9] * 4.2 * ($UserONBU[6] / $FACB);
                        > $MarTA = $UserONBU[6] - $MarPT;
                        > $FirPT = $UserBU[9] * 4.2 * ($UserONBU[8] / $FACB);
                        > $FirTA = $UserONBU[8] - $FirPT;
                        > $GhoPT = $UserBU[9] * 2 * ($UserONBU[10] / $FACB);
                        > $GhoTA = $UserONBU[10] - $GhoPT;
                        > $VulPT = $UserBU[17] * 3.3 * ($UserONBU[12] / $FACF);
                        > $VulTA = $UserONBU[12] - $VulPT;
                        > $GolPT = $UserBU[17] * 2.5 * ($UserONBU[14] / $FACF);
                        > $GolTA = $UserONBU[14] - $GolPT;
                        > $TanPT = $UserBU[17] * 2 * ($UserONBU[16] / $FACF);
                        > $TanTA = $UserONBU[16] - $TanPT;
                        >
                        >
                        > //Total SCVs and remaining SCVs to be built
                        > if ($SCVTA < 0 or $SCVTA == 0) {
                        > $SCVTAD = $UserONBU[2] + $UserONBU[1];
                        > $SCVOB = 0;
                        > } else {
                        > $SCVTAD = $SCVPT + $UserONBU[1];
                        > $SCVOB = $SCVTA;
                        > }
                        > if ($MarTA < 0 or $MarTA == 0) {
                        > $MarTAD = $UserONBU[6] + $UserONBU[5];
                        > $MarOB = 0;
                        > } else {
                        > $MarTAD = $MarPT + $UserONBU[5];
                        > $MarOB = $MarTA;
                        > }
                        > if ($FirTA < 0 or $FirTA == 0) {
                        > $FirTAD = $UserONBU[8] + $UserONBU[7];
                        > $FirOB = 0;
                        > } else {
                        > $FirTAD = $FirPT + $UserONBU[7];
                        > $FirOB = $FirTA;
                        > }
                        > if ($GhoTA < 0 or $GhoTA == 0) {
                        > $GhoTAD = $UserONBU[10] + $UserONBU[9];
                        > $GhoOB = 0;
                        > } else {
                        > $GhoTAD = $GhoPT + $UserONBU[9];
                        > $GhoOB = $GhoTA;
                        > }
                        > if ($MedTA < 0 or $MedTA == 0) {
                        > $MedTAD = $UserONBU[3] + $UserONBU[4];
                        > $MedOB = 0;
                        > } else {
                        > $MedTAD = $MedPT + $UserONBU[3];
                        > $MedOB = $MedTA;
                        > }
                        > if ($VulTA < 0 or $VulTA == 0) {
                        > $VulTAD = $UserONBU[11] + $UserONBU[12];
                        > $VulOB = 0;
                        > } else {
                        > $VulTAD = $VulPT + $UserONBU[11];
                        > $VulOB = $VulTA;
                        > }
                        > if ($GolTA < 0 or $GolTA == 0) {
                        > $GolTAD = $UserONBU[13] + $UserONBU[14];
                        > $GolOB = 0;
                        > } else {
                        > $GolTAD = $GolPT + $UserONBU[13];
                        > $GolOB = $GolTA;
                        > }
                        > if ($TanTA < 0 or $TanTA == 0) {
                        > $TanTAD = $UserONBU[15] + $UserONBU[16];
                        > $TanOB = 0;
                        > } else {
                        > $TanTAD = $TanPT + $UserONBU[15];
                        > $TanOB = $TanTA;
                        > }
                        >
                        >
                        > //Total strenght
                        > $Nstrenght = ($UserID['Size'] / 2) + ($UserBU[1] * 2 +
                        > $UserBU[3] + $UserBU[5] + $UserBU[7] + $UserBU[9] + $UserBU[11] +
                        > $UserBU[13] + $UserBU[15]) + $UserBU[17] + $UserBU[19] + ($UserONBU[1]
                        > * 2 + $UserONBU[3] + $UserONBU[5] + $UserONBU[7] + $UserONBU[9] +
                        > $UserONBU[11] + $UserONBU[13] + $UserONBU[15]);
                        >
                        > //calcul of the SCV and command center effect on minerals and
                        > gaz gathering
                        > $LCC = log10(($UserBU[1] / $UserID['Size']) * 10 + 1);
                        > $LSC = log(($UserONBU[1] / $UserID['Size']) + 1, 2);
                        > $Fac = $LCC * $LSC * $UserID['Size'] * 100;
                        >
                        > $NMin = (int)($Fac + $UserID[1]);
                        > $NGz = (int)(($Fac / 3) + $UserID[2]);
                        >
                        > //Automatic increase of land... for now.
                        > $NSize = ($UserID['Size'] * 0.01 + 1) + $UserID['Size'];
                        >
                        > $UpdateOB = mysql_query("UP DATE units SET
                        > SCVEd='$SCVTAD' ,SCVIng='$SCVOB ',MarEd='$MarTA D',MarIng='$Mar OB',FireEd='$Fi rTAD',FireIng=' $FirOB'
                        > ,GhostEd='$GhoT AD',GhostIng='$ GhoOB',MedEd='$ MedTAD',MedIng= '$MedOB',VulEd= '$VulTAD',VulIn g='$VulOB',GolE d='$GolTAD',Gol Ing='$GolOB'
                        > ,TankEd='$TanTA D',TankIng='$Ta nOB' WHERE ID='$UrsID'") or
                        > die(mysql_error ());
                        >
                        > $UpdateBU = mysql_query("UP DATE build SET
                        > CCB='$CCoTAD',C COB='$CCoOB',SD B='$DepTAD',SDO B='$DepOB',RefB ='$RefTAD',RefO B='$RefOB',Barr B='$BarTAD',Bar rOB='$BarOB'
                        > ,FacB='$FacTAD' ,FacOB='$FacOB' ,EBB='$BayTAD', EBOB='$BayOB',A caB='$AcaTAD',A caOB='$AcaOB',A rmB='$ArmTAD',A rmOB='$ArmOB',S FB='$SciTAD',SF OB='$SciOB'
                        > ,BunkB='$BunTAD ',BunkOB='$BunO B' WHERE ID='$UrsID'") or
                        > die(mysql_error ());
                        >
                        > $UpdateMG = mysql_query("UP DATE user SET
                        > Min='$NMin',Gaz ='$NGz',NW='$Ns trenght',Size=' $NSize' WHERE
                        > ID='$UrsID'") or die(showError(' 3', mysql_error())) ;
                        > }
                        >
                        >
                        >
                        > I've cut a part on the code but its basically the same thing only for
                        > the building where here its just for the units and there's 2 more
                        > cases afterwards for 2 other races, the division by zero errors I get
                        > them after "//SCV per tick" and every time I divide something by
                        > $FACB, this variable is usually not 0, its 0 now cause I'm still
                        > testing this, that said I could put a condition there cause there's
                        > no point to do that part when $FACB = 0 or $FACF =0.
                        >
                        > Is it possible that the server slows down the speed of the script for
                        > some reason ? seems to me that there's a link between the error
                        > messages and the time it takes to run the script, and this only happens
                        > with the web cron service and not when I request the url with a browser.
                        >[/color]

                        Well, among other things, when you get an error, it takes time to process the
                        error, log it and attempt to recover from it.

                        Division by zero is a hardware detected problem. So the error processing starts
                        at the very lowest level and has to percolate up the chain the the PHP error
                        recovery routines (which eventually handle it).

                        The bottom line is - you should never get run-time errors.

                        --
                        =============== ===
                        Remove the "x" from my email address
                        Jerry Stuckle
                        JDS Computer Training Corp.
                        jstucklex@attgl obal.net
                        =============== ===

                        Comment

                        Working...