CodeIgniter Forums
disabling PHP Error/Severity notices - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: disabling PHP Error/Severity notices (/showthread.php?tid=12189)



disabling PHP Error/Severity notices - El Forum - 10-09-2008

[eluser]niyogi[/eluser]
Hi folks

I'd like to disable the errors that appear within our application like the following:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: gender

Is there a setting withing CI that will disable this?


disabling PHP Error/Severity notices - El Forum - 10-10-2008

[eluser]Adam Griffiths[/eluser]
Line 12 of index.php


Code:
error_reporting(E_ALL);

Info on error_reporting


disabling PHP Error/Severity notices - El Forum - 10-10-2008

[eluser]xwero[/eluser]
Disabling errors is not a good solution. You should prevent errors from happening. in you case you need to add
Code:
$gender = '';

somewhere of use this function
Code:
function echo_var($name)
{
   return (isset(${$name})?${$name}:'';
}
But the first method is a better practice.