Home > Database > Mysql Tutorial > body text

sql update是否成功更新了数据方法

WBOY
Release: 2016-06-07 17:51:15
Original
1413 people have browsed it

获取update更新的多少行的函数用:mysql_affected_rows($conn) 或者用mysqli_affected_rows($conn)

 代码如下 复制代码

$sql = "update table a set aname='名字' where aid=88";
$r = $conn->query($sql);
if ($r){
echo "错误以为这里就是数据做了更新,如果这个aid为88的数据不存在语句同样返回true。";
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!