tags:

views:

398

answers:

4

How to turn of displaying this error in wamp: notice undefined offset Turn of only error like that, not all errors-

tnx

+2  A: 

Have a look at error_reporting().

You could e.g. set the error reporting to

error_reporting(E_ERROR | E_WARNING | E_PARSE)

But better would be to actually check what is the cause of the Notice and fix it. Then you are on the save side.

E_NOTICE
Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.

Felix Kling
+2  A: 

(If you can't fix the code...) You can exclude notices by setting an reporting level x & ~E_NOTICE, e.g.

<?php error_reporting( error_reporting() & ~E_NOTICE );

or in your php.ini (or similar)

error_reporting=E_ALL & ~E_NOTICE
VolkerK
+1  A: 

There are two issues at work here. One is what errors PHP reports, and the second is whether or not it displays those errors on the page (as opposed to the apache error log). If you'd like to turn off just NOTICES:

<?php
error_reporting(E_ALL & ~E_NOTICE);
?>

If you'd like to report the notices to your error log but not display them to the user, do this:

<?php
ini_set('display_errors','off');
?>

Note that turning off display errors will stop displaying ALL errors to the end user, and you'll need to look at the error log, usually located in /var/log/httpd/error_log to see any errors while testing.

Mike Sherov
A: 

php.ini => error_reporting = E_ALL & ~E_NOTICE

Wizard4U