How to get rid of Undefined, deprecated, warning notices in PHP

Errors in the form of Notice, Deprecated and Warning messages in a PHP program are indeed very annoying, sometimes we don’t know what the cause of the error is, instead of wanting to fix it, it makes the program even more error, so you need to know how to eliminate it. or solve this error message notice and friends in the PHP programming language.

How to Overcome Undefined, Deprecated, Warning Notice in PHP

Notice

Notice is an error message from php which indicates that the code we write does not comply with php writing standards, the cause is none other than a variable that has been declared but has not been assigned a value. How do you solve the error notice? The easiest way is to add the following syntax in a php file. Example:

<?php
error_reporting(0);//Syntax mengatasi error Notice
//syntax program lainnya
...
?>

But behind the use of this syntax, in the php program it will cause side effects, namely the inability to detect other errors such as syntax errors or fatal errors.

For that you can change it from error_reporting (0); to error_reporting (1); which is basically when you do code and debug change the value to error_reporting = 1 Then when the website is live or running you can use the value error_reporting = 0 again.

Also read: Creating Simple Input and Output Forms with PHP

Deprecated

Deprecated is a type of error caused by an outdated function, such as using a function like mysql_querysession_register () .
For that you can replace it with an example of a correct function like mysql_query () .

But if the error deprecated is too much then you can use a method like the error Notice by adding error_reporting(0);

Warning

Warning is an error that usually occurs when you perform query commands on mysql using a mysql_query () function. This error can be a human error on your own, so please double check the code carefully. You can use try catch to troubleshoot the warning message.

So that’s how to solve the Undefined, Deprecated, Warning Notice errors in PHP.
Hope this helps you.

Leave a Reply

Your email address will not be published. Required fields are marked *