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 related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

No Responses to "PHP: Hiding Errors"

Comments are closed.

Featured Sponsors


  • Michael: You can use get_header(2) in your case. The filename of your custom header has to be header-2.php. The problem with include(your_file.php) is, all
  • cliff: hi wonder if you can help me, pls i designed www.kouga.mobi using dreamweaver CS3 and now want to make the phonenumbers into links so that if you
  • jerey: how do i rewrite this because it tried RewriteEngine on #Options +FollowSymlinks RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FIL

About


Advertisements