JimmyV
JimmyV

Reputation: 61

Fatal error: Maximum execution time of 30 seconds exceeded on line 64

What i am trying to do is style a text retrieven from sql. But when i try to preview it i get *Fatal error: Maximum execution time of 30 seconds exceeded on line 64 *. I tryed puting ini_set('max_execution_time', 300); but still same problem. here is the code:

    <?php
ini_set('max_execution_time', 300);
        $info="<h3>Τεχνικά Χαρακτηριστικά</h3>";
        $sql_1 = mysql_query("SELECT * FROM info WHERE parent = '$id'")or trigger_error(mysql_error());
        $counter = mysql_num_rows($sql_1);
        if($counter > 0){
            while ($row_1 = mysql_fetch_array($sql_1)){
                $temp = $row_1['add_info'] ."</br>";
                $temp = str_split($temp);
                for($i=0; $i <= sizeof($temp); $i++){
                    if($temp[$i] == ":"){
                            break;
                    }
                }
                $temp_1="<strong>";
                for($w=0; $w < sizeof($temp); $w++){
                    if($w < $i+1){
                        $temp_1 .= $temp[$w];
                    }else if($w = $i+1){
                        $temp_1 .="</strong>";
                    }else{//this is line 64
                        $temp_1 .= $temp[$w];
                    }
                }
                $info .= $temp_1 . "<br/>";
            }
        }
?>

Upvotes: 1

Views: 1163

Answers (1)

Bruno Silva
Bruno Silva

Reputation: 3097

You are probably entering an infinite loop with line }else if($w = $i+1){, change that to }else if($w == $i+1){ or }else if($w === $i+1){.

Upvotes: 3

Related Questions