avoid error output

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Bedford

    #1

    avoid error output

    Hello,

    I've a file wich must answer a request. For this my file must generate an
    XML output.

    That's work fine but sometimes I get a wrong mysql query. In this case, I've
    to manage the output message. Problem: the mysql error message is shown, so
    the answer will have the mysql error then the XML output, and this don't
    works for the "reading" script.

    How to avoid tho show the mysql error when any ? I can't modify php.ini.

    Thanks for answer.

    Bob



  • samudas

    #2
    Re: avoid error output

    You can either append an "@" to the function, for example;
    @mysql_connect, or turn off error reporting for the whole script by
    adding these two lines to the top of your script.

    ini_set('displa y_errors', 0);
    error_reporting (0);

    Comment

    • Michael Fesser

      #3
      Re: avoid error output

      ..oO(samudas)
      [color=blue]
      >You can either append an "@" to the function, for example;
      >@mysql_connect , or turn off error reporting for the whole script by
      >adding these two lines to the top of your script.[/color]

      It would be better to check what caused the error and fix/handle it.

      Micha

      Comment

      • samudas

        #4
        Re: avoid error output

        Micha;
        That's true and i totally agree with you but in this case it doesn't
        seem the app is broken. I guess it's broken in the sense that the
        programmer isn't checking if a query result is valid. Just telling them
        what they want to know. If it were my script i'd echo something useful
        when a query result failed.

        Comment

        • Bob Bedford

          #5
          Re: avoid error output

          "samudas" <samudasu@hotma il.com> a écrit dans le message de news:
          1141291349.6935 62.72520@e56g20 00...legro ups.com...[color=blue]
          > Micha;
          > That's true and i totally agree with you but in this case it doesn't
          > seem the app is broken. I guess it's broken in the sense that the
          > programmer isn't checking if a query result is valid. Just telling them
          > what they want to know. If it were my script i'd echo something useful
          > when a query result failed.[/color]

          Thanks for your answers.
          I'm actually "answering" a remote script with XML code. id there is anything
          else than xml datas (case of a mysql error or anything else), then the
          script fails to create a good XML output and the answer is wrong.

          I've to manage if the mysql server fails (I do check and return an error in
          the XML message) instead of a message on the screen.

          Thanks for your answer !

          Bob



          Comment

          Working...