dead loop
| From: | catteddy | Date: | Sat, 02 Dec 2000 22:42:05 +0000 |
| Subject: | dead loop | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4973@lists.php.net to get a copy of this message | ||
Hello, I'm Teddy. I write a program file like belo using PHP
<?php
require 'functions.php';
$link = mssql_connect($DB_SERVER,$DB_LOGIN,$DB_PASSWORD);
if(!$link) {
DisplayErr("Can not connect to the DB");
exit();
}
$SEC_DB = mssql_select_db($DB,$link);
if(!$SEC_DB) {
DisplayErr("Can not select the DB");
exit();
}
$result = mssql_query("SELECT Q_ID FROM Quiz_Content WHERE Subject_ID = 2",$link);
if(!$result) {
DisplayErr("Can not execute the statement");
exit();
}
$max = mssql_num_rows($result);
echo $max;
$ran_s[] = 0;
while($row = mssql_fetch_array($result)) {
$ran_s[] = $row["Q_ID"];
}
reset($ran_S);
for($i=1;$i<=$max;$i++) {
echo $ran_s[$i];
echo "<BR>";
}
?>
I was using WindowNT4.0 as the web server and Microsoft SQL2000. They both install in the same
machine(PII 400 with 128MB RAM).
Every time I execute the program. It just use up almost all the resource in the NT. When I see the
TaskManager. PHP is using 99% resource.
I had ever try another methord to output the result. The problem may occur in the last For loop. It
just display some number very big. I had attach the script of the table.
Please help me!
Thanks a lot
Teddy