使用PHP在mysql更新中影响的行 [英] row(s) affected in mysql update with PHP

查看:48
本文介绍了使用PHP在mysql更新中影响的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定我的更新是否成功?我使用where uniqueName = name进行更新,因此我应该始终只更新0行或1.什么是检查我是否更新了行的好方法?

How do i find if my update is successful or not? i update using a where uniqueName=name so i should always only update 0 rows or 1. What is a good way to check if i updated a row or not?

推荐答案

mysql_affected_rows()将返回受更新影响的行数.

mysql_affected_rows() will return the number of rows affected by your update.

http://us.php.net/manual/zh/function.mysql-affected-rows.php

这篇关于使用PHP在mysql更新中影响的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆