/    Sign up×
Community /Pin to ProfileBookmark

PHP code error

In a form that have connected to a MySQL database this error keeps popping up at the top of the page:

[QUOTE]

An error occurred in script c:Inetpubwwwrootwebsiteconfig.inc on line 8

[/QUOTE]

This is the document it’s refering to:

[CODE]<?php # Script config.inc

// This script sets the error reporting and logging for the site.

error_reporting (0); // Production level

// Log a message to a text file when a problem occurs.
$message = ‘An error occurred in script ‘ . __FILE__ . ‘ on line ‘ . __LINE__ . “n”;
error_log ($message, 3, ‘errors.txt’);
?>[/CODE]

the form is supposed to be submitting details to the database but it isn’t at the moment.

Can any one help me?

Kind regards

SysX ?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@aznchong91Oct 28.2005 — all this does is error report? what are you using it for?
Copy linkTweet thisAlerts:
@SysXauthorOct 28.2005 — reporting when a PHP error occurs in each page
Copy linkTweet thisAlerts:
@avaOct 28.2005 — Does something like this work?

[code=php]//Database connect
mysql_connect('hostname','username','password') or die (mysql_error());
mysql_select_db('databasename') or die (mysql_error());

//Make query
$query = 'INSERT INTO table_name (file,line) VALUES ("' . __FILE__ . '","' . __LINE__ . '")';
mysql_query($query);[/code]
Copy linkTweet thisAlerts:
@NogDogOct 28.2005 — I think you want your include file to provide an error reporting function, perhaps?
[code=php]
<?php # Script config.inc

// This script sets the error reporting and logging for the site.

error_reporting (0); // Production level

// Log a message to a text file when a problem occurs.
function log_error($file, $line)
{
$message = 'An error occurred in script ' . $file . ' on line ' . $line . "n";
error_log ($message, 3, 'errors.txt');
}
?>
[/code]

Then you include that file at the start of any main script that wants to use it, and if you want to report an error in that script, you call the function as:
[code=php]
log_error(__FILE__, __LINE__);
[/code]
Copy linkTweet thisAlerts:
@SysXauthorOct 28.2005 — Thank you, I believe that you've fixed my problem.

SysX
×

Success!

Help @SysX spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...