#340 (in 2.5.3) MySQL Error code in Error statement

Next_minor_version
fixed
1
2013-06-11
2003-06-22
Iacopo
No

I'd find very useful to have error codes displayed on
query error.
It should be very simple: it only needs minor update to
PMA_mysql_error.
I paste a sample PMA_mysql_error:

function PMA_mysql_error($id = FALSE) {
if ($id != FALSE) {
return
PMA_convert_display_charset(mysql_error($id).'
('.mysql_errno($id).')');
} else {
return
PMA_convert_display_charset(mysql_error().'
('.mysql_errno().')');
}
}

Discussion

  • Iacopo
    Iacopo
    2003-06-22

    Logged In: YES
    user_id=701495

    Just a minor update to code sample
    Right code is:
    function PMA_mysql_error($id = FALSE) {
    if ($id != FALSE) {
    if(mysql_errno($id) != 0) {
    return
    PMA_convert_display_charset(mysql_error($id).'('.mysql_errno($id).')');
    }
    } else {
    if(mysql_errno() != 0) {
    return
    PMA_convert_display_charset(mysql_error().'('.mysql_errno().')');
    }
    }
    }

    We should filter mysql_errno()==0 to avoid reporting errors
    on succesful queries!

     
  • Garvin Hicking
    Garvin Hicking
    2003-07-23

    • assigned_to: nobody --> garvinhicking
     
  • Garvin Hicking
    Garvin Hicking
    2003-07-29

    • priority: 5 --> 1
    • summary: MySQL Error code in Error statement --> (in 2.5.3) MySQL Error code in Error statement
    • status: open --> open-fixed
     
  • Garvin Hicking
    Garvin Hicking
    2003-07-29

    Logged In: YES
    user_id=473563

    yakky,

    thanks for your code. I changed it a bit, put a
    documentation link in it and implemented in CVS. please have
    a try!

    Regards,
    Garvin.

     
  • Iacopo
    Iacopo
    2003-08-08

    Logged In: YES
    user_id=701495

    I've downloaded 2.5.3rc1. It seems ok.
    Thanks

     
  • Michal Čihař
    Michal Čihař
    2003-09-09

    • status: open-fixed --> closed-fixed
     
  • Michal Čihař
    Michal Čihař
    2013-06-11

    • Status: closed-fixed --> fixed