hello,
this is not a problem with the script, which I'll try not to criticise
here; instead it's a problem with your php installation. Since this is
PHP 4.3.2, I would suggest you redownload/reinstall PHP, and preferably
do that with the *latest* version. There's a big chance that the bug you
ran into has already been fixed.
hope that helps,
- tul
GKE wrote:
I am learning the PHP programming using Larry Ullman's book "PHP Advanced
for the World Wide Web". After successfully going through a few scripts one
script kept producing error message whenever I ran it. The script is
provided herebelow:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Football Picks</title>
</head>
<body>
<?php # Script 1.11
/* ------------------------------- */
/* Calculate the season standings. */
/* ------------------------------- */
function do_the_math ($value, $key, $total) { // This function adds up the
wins and losses.
if ($key != 0) { // Ignore the first dummy line.
$line = explode ("\t", $value); // Separate out the
username, wins, and losses.
$_REQUEST['username'] = $line[0];
$total["{$_REQUEST['username']}"]["wins"] += $line[1];
$total["{$_REQUEST['username']}"]["losses"] += $line[2];
}
}
function read_results ($dp, $directory, &$total) {
if ($file_name = readdir ($dp)) { // Search through the directory.
if (substr($file_name, 0, 8) == "results_") { // If it's a
results file ...
$the_file = $directory . $file_name;
array_walk (file ($the_file), 'do_the_math',
&$total); // Do the math on all the data.
}
read_results ($dp, $directory, $total); // Repeat through
the directory.
}
}
$total = array(); // Initialize the main variable.
$directory = '2001/';
$dp = opendir ($directory);
read_results ($dp, $directory, $total); // Start the process.
closedir ($dp);
echo "<pre>\n";
var_dump ($total); // Quickly print out the results.
echo "</pre>\n";
?>
</body>
</html>
The error message is: "PHP - This program has performe an illegal operation
and will be shut down....."
Details of the error are as follows:
PHP caused an invalid page fault in
module PHP4TS.DLL at 0167:100b8beb.
Registers:
EAX=00638528 CS=0167 EIP=100b8beb EFLGS=00010246
EBX=00000000 SS=016f ESP=00638420 EBP=00000010
ECX=00000007 DS=016f ESI=00761010 FS=5b97
EDX=007637c0 ES=016f EDI=01182e28 GS=0000
Bytes at CS:EIP:
8a 45 08 3c 04 57 89 5c 24 54 89 5c 24 5c 89 5c
Stack dump:
00761010 00000003 00000001 011827cc 00000001 00000000 0118316c 0000000b
00010003 100ba272 100bf1b0 00000000 00638580 00000000 81847340 0248c270
Could anyone help me resolve this problem.
Thanks
GKE
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php