I just configured Apache, PHP and MySQL on my windows xp pro and everything seems fine until I tried to update my database using PHP script and mysql, each time I try this there's always this error message:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
I checked my apache error log file and I got these lines:
[Tue Mar 09 20:11:49 2004] [error] [client 127.0.0.1] Premature end of script headers: d:/php4win/php.exe
[Tue Mar 09 20:19:43 2004] [error] [client 127.0.0.1] Premature end of script headers: d:/php4win/php.exe
[Wed Mar 10 00:10:24 2004] [error] [client 127.0.0.1] Premature end of script headers: d:/php4win/php.exe
I don't know what's going on, has anyone out here got a clue? I'm totally buggered now .
Here's my PHPMysql code:
<?php
$conn = mysql_connect("localhost", "root", "")
or die("It doesn't connect!");
mysql_select_db("test", $conn) or die(mysql_errno() . ": " . mysql_error() . "<br>");
$today = date("Y-m-d", time());
$sql = "SELECT DAYOFMONTH('$today')";
$result = mysql_query($sql, $conn);
echo "The day of the month is " . mysql_result($result, 0, 0) . ".";
?>
<?php
if ($action == "upload") {
// ok, let's get the uploaded data and insert it into the db now
if (isset($binFile) && $binFile != "none") {
$data = addslashes(fread(fopen($binFile, "r"), filesize($binFile)));
$strDescription = addslashes(nl2br($txtDescription));
$sql = "INSERT INTO movies ";
$sql .= "(description, clip, filename, filesize, filetype) ";
$sql .= "VALUES ('$strDescription', '$data', ";
$sql .= "'$binFile_name', '$binFile_size', '$binFile_type')";
$result = mysql_query($sql, $db);
mysql_free_result($result); // it's always nice to clean up!
echo "Thank you. The new file was successfully added to our database.<br><br>";
echo "<a href='main.php'>Continue</a>";
}
mysql_close();
} else {
?>
<HTML>
<BODY>
<FORM METHOD="post" ACTION="add.php" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<TABLE BORDER="1">
<TR>
<TD>Description: </TD>
<TD><TEXTAREA NAME="txtDescription" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD>File: </TD>
<TD><INPUT TYPE="file" NAME="binFile"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<?php
}
?😡 🙁 🙁 🙁