zero-perfoliate
zero-perfoliate

Author Topic: Browser Error caused by a PHP error  (Read 171 times)

Offline grafeety

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Browser Error caused by a PHP error
« on: August 05, 2010, 07:46:11 PM »
Hello,
I have a project which I developed at school and I am attempting to move it home. I have a local server which I have verified is in perfect working order with PHP and MySQL installed properly. My project has no errors in it, other than one function being redeclared which I fixed (due to a newer version of PHP at home than at school) now I have a worse error which is causing my browser to display an error like this:
Quote
Error 101 (net::ERR_CONNECTION_RESET): Unknown error.
When I comment out the function that was causing the redeclare error it will just give me the proper page with errors like "function not found: getText()" I checked my apache error log and got nothing, same with my php log. Does anybody have any idea what my problem is? Here is my releveant code in case you would like to read it over:

index.php:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css" media="all">@import "css/style.css";</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
</head>
<body>
<?php 
//constants file containing things like mysql pass/user/host
//text ids
include ('includes/constants.php');
//various utility functions
include ('includes/functions.php');
//connects to database
include ('includes/mysql.php');
//handles sessions
include ('includes/sessions.php');

buildToContent();

echo 
'<h1>Home</h1>';
echo 
'<h2>Current News</h2>';
echo 
getTextFromDB(NEWS_ID);
echo 
'<h2>About Us</h2>';
echo 
getTextFromDB(ABOUTUS_ID);

endAfterContent();
mysql_close();
?>

</body>
</html>

functions.php:
Code: [Select]
//function I can comment out to stop the error
function getTextFromDB($textId){
$resource = mysql_query('SELECT `content` FROM `text` WHERE `textid` = '.$textId.';');
if($resource == false){
return LOAD_TEXT_ERROR;
} else {
$text = mysql_fetch_row($resource);
if($text==false){
return LOAD_TEXT_ERROR;
} else {
$return = $text[0];
if($_SESSION['logged_in']){
$return .= '<br /><a href="edittext.php?textid='.$textId.'">edit</a>';
}

return $return;
}
}
mysql_free_result($resource);
}

Offline TinMonkey

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Re: Browser Error caused by a PHP error
« Reply #1 on: August 07, 2010, 02:26:01 AM »
well, at first glance, I would suggest you check your mysql logs. the code you are commenting out to solve the problem is mostly mysql code.

I would never make the assumption "My project has no errors in it". Especially when you run the code and get 'Error 101 (net::ERR_CONNECTION_RESET): Unknown error.' in response. I would assume you have had the error the whole time but your server at school is not reporting errors and it is on code that doesn't really matter like 'mysql_free_result($resource);' or something like that.

Good luck... nothing more fun than microsoft esque cryptic error codes.

 

zero-perfoliate