online reference to mysql_errno() codes?

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

    online reference to mysql_errno() codes?

    I want to do something like this:

    while(false == ($result = mysql_query($qu ery)) ) {
    switch(mysql_er rno()) {
    case $fixableError[0]:
    case $fixableError[1]:
    /* fix the errors */
    break;
    default:
    die ("Fatal error in '$query': " . mysql_error() );
    break;
    }
    }

    But I haven't found a satisfactory reference to the error codes. My
    googling has returned tonnes of references to files in the PHP source,
    but I'm not willing to download the source files and I doubt that
    they'd have the kind of error descriptions that would be useful (like,
    suggestions on how to avoid the error).

    So can someone supply an address to a reference list of these error
    numbers?

    Also, would the syntax in the "while" clause above work in PHP?

    TIA,
    Will

  • Mario B.

    #2
    Re: online reference to mysql_errno() codes?

    05.08.2005 18:26:27 Will Woodhull je napisao/la:
    [color=blue]
    > I want to do something like this:
    >
    > while(false == ($result = mysql_query($qu ery)) ) {
    > switch(mysql_er rno()) {
    > case $fixableError[0]:
    > case $fixableError[1]:
    > /* fix the errors */
    > break;
    > default:
    > die ("Fatal error in '$query': " . mysql_error() );
    > break;
    > }
    > }[/color]

    this is why "try, case, exception" is needed, but i don't miss it one bit
    in php :)

    --

    Comment

    • Will Woodhull

      #3
      Re: online reference to mysql_errno() codes?

      Thanks for the reply, Mario. Though I don't understand the relevance of
      your remark.

      Mario B. wrote:[color=blue]
      > 05.08.2005 18:26:27 Will Woodhull je napisao/la:
      >[color=green]
      > > I want to do something like this:
      > >
      > > while(false == ($result = mysql_query($qu ery)) ) {
      > > switch(mysql_er rno()) {[/color][/color]
      <snip>[color=blue]
      >
      > this is why "try, case, exception" is needed, but i don't miss it one bit
      > in php :)[/color]

      I know I could use PHP's try...catch construction but it seems like
      overkill in the simple code I'm developing. And I think I would still
      need to identify the error codes, so a reference list would still be
      useful?

      Maybe I'm missing something?

      Comment

      • Dana Cartwright

        #4
        Re: online reference to mysql_errno() codes?

        "Will Woodhull" <will@thornheng e.org> wrote in message
        news:1123277493 .265018.311500@ g47g2000cwa.goo glegroups.com.. .[color=blue]
        > I think I would still
        > need to identify the error codes, so a reference list would still be
        > useful?
        >[/color]

        A quick Google turned up (as the first hit):




        Comment

        • Will Woodhull

          #5
          Re: online reference to mysql_errno() codes?

          Dana Cartwright wrote:
          [color=blue]
          > A quick Google turned up (as the first hit):
          >
          > http://dev.mysql.com/doc/mysql/en/error-handling.html[/color]

          Thank you very much! This looks like it is what I need.

          I'm going to go off into a corner now, and deal privately with the
          embarrassment of having somehow managed to screw up on using Google...

          Comment

          Working...