Home  >  Article  >  Database  >  sql update是否成功更新了数据方法

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

WBOY
WBOYOriginal
2016-06-07 17:51:151414browse

获取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。";
}
Statement:
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