SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot suro's Avatar
    Join Date
    Jan 2005
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using mysql errnos to show up a user friendly error message

    Is it considered normal using mysql errno-s to know what the error is and show up a user friendly error message?

    e.g. for a duplicate entry mysql errno is 1062 and I show up a user friendly error message.
    I ask this because there is also another way of doing it.
    PHP Code:
     if (@mysql_result($result,0,0)>0) {
           
    error('A user already exists with your chosen userid.\\n'.
                 
    'Please try another.'); 
    As shown in one of sitepoints tutorials

    So which way is better?

  2. #2
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Personally I use a database class and then handle any errors internally and use a method within that class to output a user-friendly error message if there is some kind of MySQL error.


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
  •