Jump to content


Photo

Timeing out


  • This topic is locked This topic is locked
3 replies to this topic

#1 spelltwister

spelltwister
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 09 March 2006 - 12:16 AM

Hello,

First off, I was wondering if this is a PHP error or a server error and if it is, how do i make the time increase:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/online/public_html/...

Second, because the script is timing out, i was wondering if someone could help me with an array question.

I have an array: $offense_infantry = array( "number" => array(), "nation" => array() );

What happens is a bunch of infantry pieces go into this array and they can have different numbers to represent how many are there. During combat, I do this:

$upper = sizeof($offense_infantry["nation"]);
$index = rand(0,$upper-1);
if($offense_infantry["number"][$index] > 0){
$attInfantry--;
$offense_infantry["number"][$index] -= 1;
$k+=1;
}
if($offense_infantry["number"][$index] ==0){
unset($offense_infantry["number"][$index]);
unset($offense_infantry["nation"][$index]);
}

Ok, now that it's unset, I don't want to be able to hit that unit again, i want it out of the array and all the rest smushed together. Is this right? Also, after each combat, i want to unset all my arrays, can i just do this:
unset($offense_infantry); ?

Thanks.

Mike

#2 littlened

littlened
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 09 March 2006 - 01:46 PM

[!--quoteo(post=353089:date=Mar 9 2006, 12:16 AM:name=spelltwister)--][div class=\'quotetop\']QUOTE(spelltwister @ Mar 9 2006, 12:16 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hello,

First off, I was wondering if this is a PHP error or a server error and if it is, how do i make the time increase:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/online/public_html/...

Second, because the script is timing out, i was wondering if someone could help me with an array question.

I have an array: $offense_infantry = array( "number" => array(), "nation" => array() );

What happens is a bunch of infantry pieces go into this array and they can have different numbers to represent how many are there. During combat, I do this:

$upper = sizeof($offense_infantry["nation"]);
$index = rand(0,$upper-1);
if($offense_infantry["number"][$index] > 0){
$attInfantry--;
$offense_infantry["number"][$index] -= 1;
$k+=1;
}
if($offense_infantry["number"][$index] ==0){
unset($offense_infantry["number"][$index]);
unset($offense_infantry["nation"][$index]);
}

Ok, now that it's unset, I don't want to be able to hit that unit again, i want it out of the array and all the rest smushed together. Is this right? Also, after each combat, i want to unset all my arrays, can i just do this:
unset($offense_infantry); ?

Thanks.

Mike
[/quote]

the error message your getting something that is set in the PHP.ini file, which looks like it's set to 30 seconds, so a php script cannot take more than 30 seconds to complete.

#3 spelltwister

spelltwister
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 11 March 2006 - 05:42 AM

Thanks, I fixed that problem, but can anyone tell me how to remove an element from an array and shift everything else down so that it cannot be selected again and the size go down 1 as well? Thanks

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,016 posts

Posted 12 March 2006 - 12:59 AM

This is same question I have answered in your other post. Don't double post. READ FORUM GUIDELINES.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users