|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-11-01 11:11 UTC] sniper@php.net
[2000-12-07 11:27 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 02:00:01 2025 UTC |
Here's small script that allows to machine to post stats from a game to a database with verification (keep reading...): [SOME PASSWORD INFO REMOVED] <? mssql_connect("", "", ""); // Client: just insert the stats into the pending table if ($host == 0) { mssql_query("insert into pending_halfinnings(gid, inning, team, runs) values('$gid', '$inning', '$team', '$runs')"); } // Host: wait for client's data to be entered, validate it, move it to the halfinnings table else { $num = 0; $starttime = time(); while ($num == 0) { $result = mssql_query("select runs from pending_halfinnings where gid='$gid' and inning='$inning' and team='$team'"); $num = mssql_num_rows($result); // Timeout after 60 seconds of waiting for the client's post if ((time() - $starttime) >= 60) break; } mssql_query("delete from pending_halfinnings where gid='$gid'"); $arr = mssql_fetch_row($result); if ($runs == $arr[0]) mssql_query("insert into halfinnings (gid, inning, team, runs) values('$gid', '$inning', '$team', '$runs')"); } ?> Now the queries get more complicated... <? mssql_connect("slammer", "tripleplay", "easd"); // Client: just insert the stats into the pending table if ($host == 0) { mssql_query("insert into pending_pogs(gid, pog, singles, doubles, triples, homeruns, rbis, stolenbases, runsscored, wins, saves, complete, nohitter, strikeouts) values('$gid', '$pog', '$singles', '$doubles', '$triples', '$homeruns', '$rbis', '$stolenbases', '$runsscored', '$wins', '$saves', '$complete', '$nohitter', '$strikeouts')"); } // Host: wait for client's data to be entered, validate it, move it to the halfinnings table else { $num = 0; $starttime = time(); while ($num == 0) { $result = mssql_query("select * from pending_pogs where gid='$gid'"); $num = mssql_num_rows($result); // Timeout after 60 seconds of waiting for the client's post if ((time() - $starttime) >= 60) break; } mssql_query("delete from pending_pogs where gid='$gid'"); $arr = mssql_fetch_row($result); if (($arr[1] == $pog) && ($arr[2] == $singles) && ($arr[3] == $doubles) && ($arr[4] == $triples) && ($arr[5] == $homeruns) && ($arr[6] == $rbis) && ($arr[7] == $stolenbases) && ($arr[8] == $runsscored) && ($arr[9] == $wins) && ($arr[10] == $saves) && ($arr[11] == $complete) && ($arr[12] == $nohitter) && ($arr[13] == $strikeouts)) { mssql_query("insert into pogs (gid, pog, singles, doubles, triples, homeruns, rbis, stolenbases, runsscored, wins, saves, complete, nohitter, strikeouts) values('$gid', '$pog', '$singles', '$doubles', '$triples', '$homeruns', '$rbis', '$stolenbases', '$runsscored', '$wins', '$saves', '$complete', '$nohitter', '$strikeouts')"); } } ?> In this second script when the main if...else statement goes into the ELSE, the script executes completely, but the php.exe process fails to die. Once 10 of these processes build up, PHP stops responding. This is on PHP4 pl2 with MSSQL 7.0 The first script runs fine, only the more complex second script does this. Please let me know what you can about this problem. Thanks, Matt Stelzer Software Engineer Electronic Arts mstelzer@ea.com