How to avoid Maximum execution error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bootzwiz
    New Member
    • Jan 2007
    • 14

    #1

    How to avoid Maximum execution error

    Hi,
    I have a loop which inserts data to database .I need to insert 500 records one by one in a loop.

    <?
    for($i=0;$i<500 ;$i++){
    ---values insert into db
    }
    ?>

    After 30 -40 records inserting i am getting maximum execution error. Is there any alternative to handle this situation.
  • b1randon
    Recognized Expert New Member
    • Dec 2006
    • 171

    #2
    Originally posted by bootzwiz
    Hi,
    I have a loop which inserts data to database .I need to insert 500 records one by one in a loop.

    <?
    for($i=0;$i<500 ;$i++){
    ---values insert into db
    }
    ?>

    After 30 -40 records inserting i am getting maximum execution error. Is there any alternative to handle this situation.
    Try using the Set_time_limit( ) function (http://www.php.net/set_time_limit ) which will reset the maximum execution timer to 0.

    Comment

    • b1randon
      Recognized Expert New Member
      • Dec 2006
      • 171

      #3
      Originally posted by b1randon
      Try using the Set_time_limit( ) function (http://www.php.net/set_time_limit ) which will reset the maximum execution timer to 0.
      You should also consider you solution. Is there something more elegant than entering the records this way? It's horrible on performance.

      Comment

      Working...