Is there a way not to show php errors on a specific page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mkx
    Confirmed User
    • Nov 2003
    • 4001

    #1

    Is there a way not to show php errors on a specific page

    I have a php script that is doing the correct job but the page is displaying an annoying:


    Warning: Cannot modify header information - headers already sent by etc etc. error.

    Is there a way to not show errors on this specific page? There is not need to fix the problem since the script is working fine.
  • kaktusan
    Confirmed User
    • Mar 2003
    • 334

    #2
    yep, there is
    just add a code inside the php script:

    error_reporting(0);

    and you are done..


    Superior Blogging Scripts | Porn Blog Space - not just another free blog hosting!

    Comment

    • Egomancer
      Confirmed User
      • Dec 2005
      • 2074

      #3
      ;)

      Egomancer
      ICQ: 95-239-282
      WWW: www.webprogrammers.eu
      WWW:www.seodev.eu
      Y!MSN: lord_ender

      If you want to outsource any work to Romania - here I am !!!!

      www.anotheranime.com | www.autotrafic.ro | www.jocurionline.ro

      Comment

      • potter
        Confirmed User
        • Dec 2004
        • 6559

        #4
        Yeah, you could fix the script ya lazy bastard.

        Comment

        • Jace
          FBOP Class Of 2013
          • Jan 2004
          • 35562

          #5
          you can also try <no error no error> at the top of the page

          Comment

          • mkx
            Confirmed User
            • Nov 2003
            • 4001

            #6
            Originally posted by kaktusan
            yep, there is
            just add a code inside the php script:

            error_reporting(0);

            and you are done..
            Added
            <?
            error_reporting(0); ?>

            to the top of the page but it still displays

            Comment

            • mkx
              Confirmed User
              • Nov 2003
              • 4001

              #7
              Maybe I should just fix it. Here is the problem. I am adding an include file to the index.php page of my oscommerce site. The include file goes to:

              Code:
              <?php
               
              
                
              	if ($ref) 
              	
              {		
              SetCookie ("ref","$ref"); 
              	
              	
              	{
              	session_start();
              	session_register("ref");
              	}
              
              	
              	include "config.php";   
              { 
              mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 17)"); 
              mysql_db_query($database, "INSERT INTO clickthroughs VALUES ('$ref', '$clientdate', '$clienttime', '$clientbrowser', '$clientip', '$clienturl', '')") or die ("Database INSERT Error (line 18)"); 
                
              } 
               	
              } 
              
               
              ?>
              The error I am getting is


              Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/config.php:22) in /home/site/public_html/includes/functions/general.php on line 1174

              Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition <b>navigationhistory</b> of the object you are trying to operate on was loaded _before_ the session was started in /home/site/public_html/includes/application_top.php on line 322

              Comment

              • Tempest
                Too lazy to set a custom title
                • May 2004
                • 10217

                #8
                To suppress the error(s), put an @ in front of the function causing it.

                eg:
                @session_start
                @session_register
                @include
                @mysql_connect
                @mysql_db_query

                Can also be helpfull if you're not sure which one if throwing the error, i.e. put @ in front of all of them and then remove one at a time until you see the error.

                Comment

                • woj
                  <&(©¿©)&>
                  • Jul 2002
                  • 47880

                  #9
                  you might have a blank line in config.php at the very end, right below ?>

                  look around line 22 in config.php and see what's there...
                  Last edited by woj; 06-17-2006, 05:30 AM.
                  Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                  Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                  Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                  Comment

                  • Jace
                    FBOP Class Of 2013
                    • Jan 2004
                    • 35562

                    #10
                    seriously, put this in the beginning of every page <NO ERROR>

                    you will be FINE!!!

                    Comment

                    Working...