RE: [PHP] CPU usage @5% during 2 minutes

From: Date: Tue, 19 Oct 2004 21:45:42 +0000
Subject: RE: [PHP] CPU usage @5% during 2 minutes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-199831@lists.php.net to get a copy of this message
>How any rows are you pulling from the database? aprrox. 12.000 but there are only around 50-100 new rows at a maximum within a day, and there were almost as many before the problem appeared. > >What's the very last part of the code: .$_OR?> There is a switch, some echoes and a db_close; > >Have you tried this code in a separate script to test it's performance >individually? Yes, then it performs good. This seems to be strange and irrelevant to me, because placing a $tmpsting .= microtime()."<br>\n"; into each loop and then echoing it shows, that there are randomly processing gaps between two cycles when running as a part of the whole. > >> -----Original Message----- >> >> The sample code (in seperate, this piece of code runs with >> normal speed, >> but it is this part which runs slowly when executed as a whole, >> everything else is fast): >> >> >> $sqlquery = "SELECT sh_Number, sh_Status FROM >> service_sheet ORDER BY >> sh_Number DESC"; >> $result = mysql_query($sqlquery) >> or die (mysql_error()."<br><br>"._ERROR_QUERY.": >> ".$sqlquery); >> echo " <SELECT >> onchange=\"this.form.service_sheet_worknum.value = >> this.value;\" class=\"service_sheet_list\" >> name=\"service_sheet\">"; >> while (list($shID, $shStatus, $shWNum, $custName) = >> mysql_fetch_row($result)) { >> switch ($shStatus) { >> case 1: >> $option_class = "status_1"; >> break; >> case 2: >> $option_class = "status_2"; >> break; >> case 3: >> $option_class = "status_3"; >> break; >> case 4: >> $option_class = "status_4"; >> break; >> case 5: >> $option_class = "status_5"; >> break; >> } >> echo "<OPTION class=\"$option_class\" >> value=\"$shID\">$shID</OPTION>"; >> } >> echo "</SELECT>&nbsp;&nbsp;&nbsp;&nbsp;"._OR;?> >>

« previous php.general (#199831) next »