scriptygoddess

30 Sep, 2004

PHP: Hiding Errors

Posted by: Jennifer In: Lessons learned

I was running into a problem with undefined index errors. You'll get that if you do seomthing like:

echo $_GET['name'];

when there is no $_GET['name']. One option is to check to make sure $_GET['name'] is set like

if (isset($_GET['name'])) {
echo $_GET['name'];
}

But if you're feeling lazy, you can leave your code as is and just add this at the top of your file

error_reporting(E_ALL ^ E_NOTICE);

Alternatively, turning off those notices is a setting you can adjust in .ini file, but if you don't have access to that file, then just putting that error_reporting line in your code will suffice
[found on experts exchange thread]

No Responses to "PHP: Hiding Errors"

Comments are closed.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements