How to get ID of the last updated row in MySQL?

后端 未结 12 2498
北海茫月
北海茫月 2020-11-22 08:10

How do I get the ID of the last updated row in MySQL using PHP?

12条回答
  •  生来不讨喜
    2020-11-22 08:33

    Further more to the Above Accepted Answer
    For those who were wondering about := & =

    Significant difference between := and =, and that is that := works as a variable-assignment operator everywhere, while = only works that way in SET statements, and is a comparison operator everywhere else.

    So SELECT @var = 1 + 1; will leave @var unchanged and return a boolean (1 or 0 depending on the current value of @var), while SELECT @var := 1 + 1; will change @var to 2, and return 2. [Source]

提交回复
热议问题