Return value of mysql_affected_rows

Source: Internet
Author: User
Return value of mysql_affected_rows
$ Result = mysql_query ("update user set sex = '{$ _ clean ['sex']}', face = '{_ _ clean ['face']}', qq = '{$ _ clean ['QQ']}', email = '{$ _ clean ['mail']}', url = '{$ _ clean ['URL']}' where username = '{$ _ COOKIE ['username']}' ", $ conn );


Why is the returned value of mysql_affected_rows () 0 and the execution result correct? is it true that the number of affected rows is not returned in principle?

You cannot use the value of $ result to determine whether the result is successful.


Reply to discussion (solution)

Mysql_affected_rows returns 0, indicating that no record is modified.
However, the update command is correct.

But the result is indeed modified!

But I didn't see you execute mysql_affected_rows.

Sorry, it was my own mistake. when I wrote data to the database in the early stage, I accidentally had two usernames with the same values. so I was not careful that mysql_affected_rows () was 2!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.