I-R-Fool Posted November 27, 2009 Share Posted November 27, 2009 I've done the suggestion tutorial, with the php info script, but now I'm getting this error on the output:Error: Fatal error: Maximum execution time of 30 seconds exceeded in C:\web\apache\htdocs\ajax\suggestions\gethint.php on line 41Any ideas? Link to comment Share on other sites More sharing options...
Ingolme Posted November 27, 2009 Share Posted November 27, 2009 What does your PHP code look like? It sounds like you've triggered an infinite loop to me. Link to comment Share on other sites More sharing options...
I-R-Fool Posted November 28, 2009 Author Share Posted November 28, 2009 <?phpheader("Expires: Mon, 26 Jul 1997 05:00:00 GMT");header("Cache-Control: no-cache");$a[]="Anna";$a[]="Brittany";$a[]="Cinderella";$a[]="Diana";$a[]="Eva";$a[]="Fiona";$a[]="Gunda";$a[]="Hege";$a[]="Inga";$a[]="Johanna";$a[]="Kitty";$a[]="Linda";$a[]="Nina";$a[]="Ophelia";$a[]="Petunia";$a[]="Amanda";$a[]="Raquel";$a[]="Cindy";$a[]="Doris";$a[]="Eve";$a[]="Evita";$a[]="Sunniva";$a[]="Tove";$a[]="Unni";$a[]="Violet";$a[]="Liza";$a[]="Elizabeth";$a[]="Ellen";$a[]="Wenche";$a[]="Vicky";$q = $_GET['q'];if(strlen($q) > 0) { $hint = ""; for($i=0; $i<count($a); $i++) { if(strtolower($q) == strtolower(substr($a[$i], 0, strlen($q)))) { if($hint == "") { $hint = $a[$i]; } else { $hint = $hint.", ".$a[$i]; } } }}if($hint == "") { $response = "No Suggestion Found"; } else { $resposne = $hint; }echo $response;?> Link to comment Share on other sites More sharing options...
jeffman Posted November 28, 2009 Share Posted November 28, 2009 I tested your code. I cannot see anything that would cause the error you mentioned. I did notice a typing error here:$resposne = $hint;When I correct it, your code works fine.And there are many places where the PHP uses bad practices, but they shouldn't cause an error. I realize you are copying the code from the school's page, so I am not criticizing you. Link to comment Share on other sites More sharing options...
I-R-Fool Posted November 28, 2009 Author Share Posted November 28, 2009 I tested your code. I cannot see anything that would cause the error you mentioned. I did notice a typing error here:$resposne = $hint;When I correct it, your code works fine.And there are many places where the PHP uses bad practices, but they shouldn't cause an error. I realize you are copying the code from the school's page, so I am not criticizing you.Yea, I fixed that too. It was my mistake. I didn't c/p it. I just wrote it over. I'm quite good at php, but I found it would be faster to rewrite it then to code it myself. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.