SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast cragthehack's Avatar
    Join Date
    Jul 2001
    Location
    Ft. Lauderdale, FL. USA
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I supress errors?

    How can i supress undefinied variables error messages in PHP?
    - crag
    net geek for non profits and political campaings

  2. #2
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can set the error reporting level of PHP (You can read here), Write this line at the top of your script:

    error_reporting (2039);

    or

    error_reporting (E_ALL ^ E_NOTICE);

  3. #3
    Digital Warrior Renegade's Avatar
    Join Date
    Nov 2000
    Location
    Portland, OR
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More simply, given the following code:

    PHP Code:
    if ($submit)
    {

    If the submit variable does not exist, you can supress the errors by placing a @(at symbol. Shift-2) in front of the variable. like this:

    PHP Code:
    if (@$submit)
    {

    The @ works for just about anything. Try it where you are getting the error...

    hope that helps..
    --There's my 1.5 cents, now where is my change!?!?

  4. #4
    SitePoint Enthusiast cragthehack's Avatar
    Join Date
    Jul 2001
    Location
    Ft. Lauderdale, FL. USA
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Both work. The problem is other PHP scripts. Like ADODB which always fires off a few of these errors. Is there a way to supress them in the php.ini file? Although, maybe that isn't wise?
    - crag
    net geek for non profits and political campaings

  5. #5
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by cragthehack
    Is there a way to supress them in the php.ini file? Although, maybe that isn't wise?
    Short answer is yes there is - but I don't have the reference to the exact spot in the manual on hand.

    Its not necessarily a bad thing to turn off error reporting. It is more there for debugging purposes during development.

  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The setting is called display_errors

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  7. #7
    SitePoint Enthusiast cragthehack's Avatar
    Join Date
    Jul 2001
    Location
    Ft. Lauderdale, FL. USA
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks...
    - crag
    net geek for non profits and political campaings


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •