php - MySQL time-exceeded error -


i working on ajax testing platform. experiencing stupid errors in php programming. here code. error: maximum execution time of 30 seconds exceeded.

<?php $resultfromjson;  $databaseconnection = mysql_connect("localhost", "root", "password"); if($databaseconnection)mysql_select_db("fastdata", $databaseconnection); else echo mysql_error($databaseconnection);  if(isset($_get['command'])){     switch($_get['command']){         case "loadpeople":         {             $sqlcommandstring = "select *  `people` limit 0 , 30";              $people = array();             $index = 0;             while($row = mysql_fetch_assoc(mysql_query($sqlcommandstring))){                 $people[$index] = $row;                 $index++;                }              echo json_encode( $people );         }         break;       } }  if(!isset($_get['command']))echo json_encode( "error#001" );  ?> 

what can solve error? causes error?

p.s. testing php script directly in browser main.php?command=loadpeople url.

execute query, then loop through results; don't try re-execute query in every iteration of while

$resultset = mysql_query($sqlcommandstring); while ($row = mysql_fetch_assoc($resultset)) { 

as you're learning basics, i'd suggest learn use mysqli or pdo rather deprecated mysql library... being able use prepared statements , bind variables doesn't affect query, knowing how use them become more important later


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -