Suppress mysql errors on php

2019-02-20 01:29发布

I know that in general the php errors can be suppressed using error_reporting(0) or the '@'. I have many sql queries being fired in a certain section of my work, I wanted to know that does adding error_reporting(0) suppress the appearance of errors arising from mysql queries?

I read online varying answers. Some state it will help while others say it wont work like that .

2条回答
你好瞎i
2楼-- · 2019-02-20 01:53

If you have htaccess file then you can controll all errors by this. try this

查看更多
叛逆
3楼-- · 2019-02-20 01:54

Try putting this at the top of your code:

ini_set("display_errors", "off");

And yes, adding @ at the beginning of functions etc, for example:

$query = @mysql_query("text..");

Should suppress errors.

查看更多
登录 后发表回答