0

In our PHP application, currently mysql query errors (syntax errors, duplicate entry errors for unique keys) are not throwing PHP errors, and script execution is continuing, which is fine.

I just want to know what setting (if it can be controlled by a setting) can stop script execution in the above mentioned cases, so that we are well aware and do not unknowingly do this by mistake.

I just read this question MySQL - ignore insert error: duplicate entry, which is about avoiding errors on duplicate entry attempts on unique fields. The answer by @zombat mentions using insert ... ignore to cause warnings instead of errors when there is a duplicate data entry attempt. So, it seems like a duplicate entry attempt (using insert and not insert ... ignore) causes a PHP error and script execution stops. Is this the default behavior?

I am not getting the PHP errors, at the first place. So, how do I get them?

Community
  • 1
  • 1
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144

1 Answers1

1

You should show some code.

But a few possibilities are:

You use error surpression with @ before the possible offending command.

You have custum errorhandlers that let the script continue.

You use exceptions instead of errors, and catch them.

Read here: http://php.net/manual/en/function.set-error-handler.php

We really need some code and some settings. You could scan your project for the string: set_error_handler

Erwin Moller
  • 2,375
  • 14
  • 22