Phpmysql method for determining whether an update is performed after the update _ PHP Tutorial

Source: Internet
Author: User
Phpmysql determines whether an update is performed after update. First of all, I suggest you navigate through the problem. The php Manual is rummaged over 1001 times to solve the problem. I am Baidu, and there are a variety of answers from netizens. First, correct Baidu's mistake. First of all, my suggestion is to navigate through the problem. The php manual goes over 1001 times to solve the problem.

I am Baidu, and there are a variety of answers from netizens.

First, correct Baidu's mistake:

The code is as follows:


$ SQL = "update table a set aname = 'name' where aid = 88 ";
$ R = $ conn-> query ($ SQL );
If ($ r ){
Echo "indicates that the data is updated here. if the data with the aid of 88 does not exist, true is returned. ";
}


The where statement returns true even if the SQL statement is correct. the true statement can be interpreted as "no error" in the SQL statement, which has the same effect as the write statement: $ conn-> query ($ SQL) or die ("An error occurred while updating. check whether the parameters are correct. ");.
Use mysql_affected_rows ($ conn) or mysqli_affected_rows ($ conn) to obtain the updated rows)

Bytes. I am Baidu, and there are a variety of answers from netizens. First, correct Baidu's mistake...

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.