I've posted this in the php.db mailing list, but also thought I'd post it here in case any of you don't subscribe. This problem's driving me nuts and I don't know if it's PHP or IIS:
I posted a message yesterday about what I thought was an ODBC connection
hang. We had the problem for several hours yesterday, but our host could
see no problems with our connection. (php3, odbc, ms sql 7)
Today, it was working for a while. In fact I used the form below to
populate the "people" table over 60 times. I had it freeze on one
person, but then work a few minutes later. I then had it freeze again
later on another person and that's when I noticed the strangeness in a
different light.
[As you can see the form uses PHP_SELF to reload so that it inserts the
SQL statement and then is ready for the next entry. When I say it
freezes, I hit submit, the form doesn't reload and the server dishes up
an empty html page.]
OK. I had it freeze while entering [Peta] [Wilson]
[http://www.digitalhit.com/petawilson.shtml] in the input boxes.
The form wouldn't reload. I tried again and again. Didn't work.
I entered another performer's name and URL. It worked. Tried Peta's info
again. No luck.
On a whim I entered [Peta] [Wilson]
[http://www.digitalhit.com/petawilsonblah.shtml] into the input boxes.
Adding the blah to the celebrityrowurl variable worked. I began to think
this wasn't a SQL problem.
I added the echo $step; $step++; to the code to see if I could see where
it failed. I entered another name and URL combo and received the 1 2 3 4
5 6 7 steps echo. I tried entering the original [Peta] [Wilson]
[http://www.digitalhit.com/petawilson.shtml] again.
Not one step number was printing, so the page was halting right after
the if ($REQUEST_METHOD == 'POST') {
Is there any way that PHP can be freezing on the POSTed variables? That
changing the variables being POSTed allows the process to continue but
trying the same variables again causes the freeze? And it's not these
specific variables. I might be able to go and submit Peta's info a few
hours from now without any problem.
Call me confused.
<head>
<title>Celebrity Row Inserter</title>
<?php
include('connect.inc')
?>
</head>
<body>
<h1>Digital Hit's Celebrity Row Inserter</h1>
<?php
if ($REQUEST_METHOD == 'POST')
{
$step="1";
echo $step;
$step++;
$celebrityrowurl = substr ("$celebrityrowurl",25);
echo $step;
$step++;
$sql="INSERT into people (firstname, lastname, celebrityrowurl) VALUES
('$firstname', '$lastname', '$celebrityrowurl')";
echo $step;
$step++;
$sql = str_replace("\'","''",$sql);
echo $step;
$step++;
$sql = stripslashes($sql);
echo $step;
$step++;
$result = odbc_exec($connect, $sql);
echo $step;
$step++;
@odbc_close($connect);
echo $step;
$step++;
}
?>
<form action="<?php ECHO $PHP_SELF ; ?>" method="POST"><br />
<b>First Name:</b><input type="text" name="firstname" size="15"
maxlength="30" value="" />
<b>Last Name:</b><input type="text" name="lastname" size="15"
maxlength="30" value="" /><br />
<b>Celebrity Row URL:</b><br />
<input type="text"
name="celebrityrowurl" size="100" maxlength="200"
value="" /><br />
<input type="SUBMIT" value="Insert Data" /><input type="RESET"
value="Reset" /><br />
</form>
[p.s. don't fret over the $sql = str_replace("\'","''",$sql); $sql =
stripslashes($sql); lines. It's a weird workaround caused by ms sql and
the way our host has the shared php.ini set. It works.]