Log in

View Full Version : disabling mysql_connect error message



mutago
02-14-2014, 08:04 PM
please i need to know how to disable mysql_connect error message in php while am rewriting the codes to PDO.

some suggest

1: adding @ at the begining of the connection. as follow

@mysql_connect

2: removing the or die() functions

3: setting DEBUG_MODE = 2 in every php file and in php.ini.

source is below

http://help.x-cart.com/index.php?title=X-Cart:Config.php#Correcting_debug_mode

what do i do

Thank you

traq
02-14-2014, 09:47 PM
You should not disable the error messages. If you are getting an error message, it means there is an error. Errors are for fixing, not ignoring.

1. The @ (error suppression operator) is intended to allow you to build your own error handling procedures, not to allow you to ignore errors.

2. ... or die() construct is acceptable for debugging, but it is not good error handling. In this case, however, it's not what you're looking for anyway. It doesn't suppress or fix errors: quite the opposite, it stops the script dead in its tracks.

3. DEBUG_MODE (http://php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) is not a core php.ini directive for error handling, so I don't know what it does. Whoever recommended it most likely assumed you were using a particular debugging tool/extension that uses this setting.

If you share the particular error message you are getting, we can help you troubleshoot and solve the problem.

mutago
02-15-2014, 06:58 PM
You are right Traq.

Thank You

traq
02-15-2014, 10:35 PM
Need help with it?