Professional Web Applications Themes

When UPDATE doesn't work.. - MySQL

eg UPDATE MyTable SET SomeField = 20 WHERE AnotherField = -1 If the table MyTable has no record with AnotherField = -1, obviously no update will take place, and the query will end normally. Is there any way to capture the fact that no update has taken place (other than the obvious trick of determining prior to the update whether AnotherField = -1 exists)?...

Sponsored Links
  1. #1

    Default When UPDATE doesn't work..

    eg

    UPDATE MyTable SET SomeField = 20 WHERE AnotherField = -1

    If the table MyTable has no record with AnotherField = -1, obviously no
    update will take place, and the query will end normally. Is there any
    way to capture the fact that no update has taken place (other than the
    obvious trick of determining prior to the update whether AnotherField =
    -1 exists)?

    Sponsored Links
    Occidental Guest

  2. #2

    Default Re: When UPDATE doesn't work..

    Occidental wrote: 

    Depending on the language you're using, you can get the affected rows.
    For instance, in PHP it's mysql_affected_rows().

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  3. #3

    Default Re: When UPDATE doesn't work..

    On Fri, 15 Sep 2006 18:22:14 -0400, Jerry Stuckle
    <net> wrote:
     
    >
    >Depending on the language you're using, you can get the affected rows.
    >For instance, in PHP it's mysql_affected_rows().[/ref]

    In Rexx, it's sqlca.rowcount

    Lee
    Lee Guest

  4. #4

    Default Re: When UPDATE doesn't work..

    >> eg 
    >
    > Depending on the language you're using, you can get the affected rows.
    > For instance, in PHP it's mysql_affected_rows().[/ref]

    Beware though, that the rows where SomeField was already 20 do not count
    as "affected".

    Best regards
    Dikkie Guest

  5. #5

    Default Re: When UPDATE doesn't work..

    Dikkie Dik wrote: 
    >>
    >> Depending on the language you're using, you can get the affected rows.
    >> For instance, in PHP it's mysql_affected_rows().[/ref]
    >
    > Beware though, that the rows where SomeField was already 20 do not count
    > as "affected".
    >
    > Best regards[/ref]

    Well, they don't have anything to do with the query to begin with.

    Norm
    Norman Guest

  6. #6

    Default Re: When UPDATE doesn't work..

    On 22 Feb, 10:58, Norman Peelman <rr.com> wrote: 

    Why don't they?

    Captain Guest

Similar Threads

  1. Dynamically update treenode doesn't work in DW8 floaterpanel.
    By dongxun in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 0
    Last Post: January 23rd, 08:04 AM
  2. Update MS Access record doesn't work right
    By Tsengtan in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 2
    Last Post: July 13th, 10:43 AM
  3. C3 doesn't update DW template files
    By Andrewvoa in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: February 28th, 05:53 PM
  4. why is the "Adobe Acrobat 6.0.1 Update" message there at the top? -- the update doesn't work
    By john_cummin@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 6
    Last Post: August 5th, 01:51 PM
  5. Copy/Paste attributes doesn't work in update....
    By mbahnen webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 2
    Last Post: September 17th, 04:38 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139