php mysql php mysql to determine whether updated after Update method

Source: Internet
Author: User
First of all, my advice is to encounter problems Ferry, PHP manual over 1001 times, the problem solved.
I Baidu a bit, netizens give the answer a variety of.
First correct Baidu to a wrong way:

Copy the Code code as follows:


$sql = "Update Table a set aname= ' name ' where aid=88";
$r = $conn->query ($sql);
if ($r) {
echo "Error that this is the data is updated, if the aid for 88 of the data does not exist The statement also returns TRUE. ";
}


A statement with where, even if it does not conform to the adjustment as long as the SQL statement is true, the true can be understood as the SQL statement is not error, and this write is the same effect: $conn->query ($sql) or Die ("Update error, please check the parameters are correct.") ");。
Gets the number of rows of update updates for the function by: mysql_affected_rows ($conn) or with Mysqli_affected_rows ($conn)

The above describes the PHP mysql php mysql to determine whether the updated after the update, including the content of the PHP MySQL, I hope to be interested in PHP tutorial friends helpful.

  • 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.