Anokha Ladla
Anokha Ladla

Reputation: 13

How to remove error messages?

I have used this code for removing errors:

error_reporting($level = NULL);

It gave me a result with blank page. How migh I neglect php errors and load a page normally?

Upvotes: 0

Views: 535

Answers (3)

Rahul
Rahul

Reputation: 1181

use error_reporting(0);

it will suppress all the errors on the page...

and to suppress an error that can occur on a specific statement such as database loading..

you can use.. @

eg:

$db = @mysqli_query($dbc, '....query....');

It will solve your problem..

Upvotes: 0

TravisO
TravisO

Reputation: 9540

You can set what types of notifications you get using https://www.php.net/manual/en/function.error-reporting.php

error_reporting(E_ALL|E_ERROR|0);

and you can toggle if they show or not with https://www.php.net/manual/en/function.ini-set.php

ini_set('display_errors','On|Off');

and when I write A|B I mean you choose A or B, not both

Upvotes: 1

DeiForm
DeiForm

Reputation: 664

error_reporting(0);

or disable error for 1 function - @function_name();

Disabling erros is highly discouraged. You should fix errors.

Upvotes: 1

Related Questions