Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2000121

[PHP-DB] dead loop From: catteddy (catteddy <email protected>)
Date: 12/02/00

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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>