on error

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

    #1

    on error

    Hi alt all
    $connection = mysql_connect(" 12.34.5.67.89", "Sql111111","hE LLOWORLD");
    mysql_select_db ("11111111_1 ")
    $query = "SELECT from where.......... .....
    in any of these 3 steeps it can make error or any visitor can try to call a
    different database or make irs own query
    what can I do To be sure that on error in any of these 3 seep the PHP code
    self call a certain page?
    Thank you in advance and regards


  • Erwin Moller

    #2
    Re: on error

    Robertu wrote:
    Hi alt all
    Hi Robertu,
    $connection = mysql_connect(" 12.34.5.67.89", "Sql111111","hE LLOWORLD");
    mysql_connect returns a value.
    Check at www.php.net for details.

    In this case FALSE is returned if the mysql_connect fails.
    So you'll end up with something like this:
    $connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
    if ($connection === FALSE){
    echo "problem connecting...";
    exit;
    }

    2 notes:
    - The @ supresses a possible errormessage.
    - the === is NOT a typo.
    mysql_select_db ("11111111_1 ")
    Also, check www.php.net for returnvalues.
    $query = "SELECT from where.......... .....
    This will probably not produce an error since you only construct the string.
    But when you execute it you can get an error.
    Also, check the returnvalue here too.

    Good luck!

    Regards,
    Erwin Moller
    in any of these 3 steeps it can make error or any visitor can try to call
    a different database or make irs own query
    what can I do To be sure that on error in any of these 3 seep the PHP code
    self call a certain page?
    Thank you in advance and regards

    Comment

    • Darko

      #3
      Re: on error

      On May 18, 5:14 pm, Erwin Moller
      <since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
      Robertu wrote:
      Hi alt all
      >
      Hi Robertu,
      >
      $connection = mysql_connect(" 12.34.5.67.89", "Sql111111","hE LLOWORLD");
      >
      mysql_connect returns a value.
      Check atwww.php.netfo r details.
      >
      In this case FALSE is returned if the mysql_connect fails.
      So you'll end up with something like this:
      $connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
      if ($connection === FALSE){
      echo "problem connecting...";
      exit;
      >
      }
      >
      2 notes:
      - The @ supresses a possible errormessage.
      - the === is NOT a typo.
      >
      mysql_select_db ("11111111_1 ")
      >
      Also, checkwww.php.ne tfor returnvalues.
      >
      $query = "SELECT from where.......... .....
      >
      This will probably not produce an error since you only construct the string.
      But when you execute it you can get an error.
      Also, check the returnvalue here too.
      >
      Good luck!
      >
      Regards,
      Erwin Moller
      >
      in any of these 3 steeps it can make error or any visitor can try to call
      a different database or make irs own query
      what can I do To be sure that on error in any of these 3 seep the PHP code
      self call a certain page?
      Thank you in advance and regards
      Nothing to add :)

      Comment

      • Robertu

        #4
        Re: on error

        "Erwin Moller"
        WROTE:
        Hi Robertu,
        >
        >$connection = mysql_connect(" 12.34.5.67.89", "Sql111111","hE LLOWORLD");
        >
        mysql_connect returns a value.
        Check at www.php.net for details.
        >
        In this case FALSE is returned if the mysql_connect fails.
        So you'll end up with something like this:
        $connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
        if ($connection === FALSE){
        echo "problem connecting...";
        exit;
        }
        Hi Erwin and tank you very much
        NOW I wrote
        $connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
        if ($connection === FALSE)
        {
        header("www.pip po.es/");
        exit();
        }

        can it work?

        I tryed also:
        $connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
        if ($connection === FALSE)
        {
        out();
        }

        function out()
        {
        header("www.pip po.it/");
        exit();}

        Thank you in advance and best regards


        Comment

        • Schraalhans Keukenmeester

          #5
          Re: on error

          At Sat, 19 May 2007 07:19:18 +0000, Robertu let his monkeys type:
          "Erwin Moller"
          WROTE:
          >
          >Hi Robertu,
          >>
          >>$connection = mysql_connect(" 12.34.5.67.89", "Sql111111","hE LLOWORLD");
          >>
          >mysql_connec t returns a value.
          >Check at www.php.net for details.
          >>
          >In this case FALSE is returned if the mysql_connect fails.
          >So you'll end up with something like this:
          >$connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
          >if ($connection === FALSE){
          >echo "problem connecting...";
          >exit;
          >}
          >
          Hi Erwin and tank you very much
          NOW I wrote
          $connection = @mysql_connect( "12.34.5.67.89" , "Sql111111","hE LLOWORLD");
          if ($connection === FALSE)
          {
          header("www.pip po.es/");
          exit();
          }
          >
          can it work?
          >
          Use header('Locatio n:http://www.pippo.es');

          And make sure there is NO output by your script before sending the
          custom header, as that will cause a header to be already sent.

          HTH
          Sh.

          Comment

          Working...