showerror() vs mysql_error() ..... difference

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

    #1

    showerror() vs mysql_error() ..... difference

    Could someone give me the quick difference betweeen the 2 error
    functions and why one should use one or the other.



    if (!mysql_select_ db($database, $connection))
    showerror();

    $connection = mysql_connect(' mysql_host', 'mysql_user', mysql_password' )
    or die('Could not connect: ' . mysql_error());


    TIA
  • =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=

    #2
    Re: showerror() vs mysql_error() ..... difference

    user wrote:
    Could someone give me the quick difference betweeen the 2 error
    functions and why one should use one or the other.
    >
    if (!mysql_select_ db($database, $connection))
    showerror();
    >
    $connection = mysql_connect(' mysql_host', 'mysql_user',
    mysql_password' ) or die('Could not connect: ' . mysql_error());
    Since the PHP manual doesn't list a function named showerror(), I can
    only guess that it's a user-created function (ie. created by whoever
    wrote the script), while mysql_error() is a built-in function that
    retrieves the last error message from MySQL (or a blank string if the
    last query/access was successful).

    --
    Kim André Akerø
    - kimandre@NOSPAM betadome.com
    (remove NOSPAM to contact me directly)

    Comment

    • Kimmo Laine

      #3
      Re: showerror() vs mysql_error() ..... difference

      "user" <someone@somepl ace.orgwrote in message
      news:6ogrh.7396 63$QZ1.371372@b gtnsc04-news.ops.worldn et.att.net...
      Could someone give me the quick difference betweeen the 2 error functions
      and why one should use one or the other.
      >
      >
      >
      if (!mysql_select_ db($database, $connection))
      showerror();
      >
      $connection = mysql_connect(' mysql_host', 'mysql_user', mysql_password' )
      or die('Could not connect: ' . mysql_error());

      mysql_error is a built-in function, comes in the package, and showerror is
      something used only in the php project you are working with. Ask the person
      who wrote the script, it's not a common php function. It's possible that it
      has more sophisticated error handling than what mysql_error provides.

      --
      "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
      http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
      spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


      Comment

      • user

        #4
        Re: showerror() vs mysql_error() ..... difference

        Thanks to both of you.

        Kimmo Laine wrote:
        "user" <someone@somepl ace.orgwrote in message
        news:6ogrh.7396 63$QZ1.371372@b gtnsc04-news.ops.worldn et.att.net...
        >
        >>Could someone give me the quick difference betweeen the 2 error functions
        >>and why one should use one or the other.
        >>
        >>
        >>
        >>if (!mysql_select_ db($database, $connection))
        >>showerror() ;
        >>
        >>$connection = mysql_connect(' mysql_host', 'mysql_user', mysql_password' )
        >>or die('Could not connect: ' . mysql_error());
        >
        >
        >
        mysql_error is a built-in function, comes in the package, and showerror is
        something used only in the php project you are working with. Ask the person
        who wrote the script, it's not a common php function. It's possible that it
        has more sophisticated error handling than what mysql_error provides.
        >

        Comment

        Working...