I'm running PHP 4.3 under Windows XP, and I'm new to PHP. Please forgive the newbie question.
I obviously want the interpreter to post parsing errors atop whatever web page is on the screen. But in a production system, I'd rather not have errors, like database connection problems, be displayed. I've written code to catch those errors and I'd like to control the presentation process.
Instead, I'm getting things like this: "Warning: mysql_connect(): Access denied for user: 'ESIAdmin@localhost' (Using password: YES) in C:\Apache\Apache2\htdocs\e-butle.com\PHPScripts\Login02.php on line 54
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\Apache\Apache2\htdocs\e-butle.com\PHPScripts\Login02.php on line 56"
Is there any way to keep these errors from being displayed?
Thanks.
HDW
Those Pesky Error Messages
Moderator: General Moderators
Yes, That's Right
The user name and password are wrong. I entered them incorrectly to test the program logic I'd developed. Not only did my programming logic catch the error, as it is designed to do, but in addition, I get the PHP error messages--and I don't want them to appear to the user.
HDW
HDW
use @ in front of mysql_connect and mysql_select_db, i.e.
you can use it with any function to shut it up 
Code: Select all
<?php
@mysql_connect('host', 'username', 'password') or die('cant connect to host...');
?>- Ixplodestuff8
- Forum Commoner
- Posts: 60
- Joined: Mon Feb 09, 2004 8:17 pm
- Location: Queens, New York
You can do the @ thing for each function, or you can turn off error reporting for everything using this line: error_reporting(0);
Here is the manual page on error reporting
Here is the manual page on error reporting
