国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php更新mysql后獲取影響的行數發生異常解決方法

2024-05-04 23:08:26
字體:
來源:轉載
供稿:網友
從manual上知道了mysql_affected_rows函數當UPDATE前后的數據一樣時會返回異常值,

下面有個方便的解決辦法,從官方munual上看到 bdobrica at gmail dot com 留言的:
As a solution to the problem pointed in the post reffering to mysql_affected_rows() returning 0 when you are making an update query and the fields are not modified although the query is valid, i'm posting the following function. It is very simple and based on a previous post.

復制代碼 代碼如下:


function mysql_modified_rows () {
$info_str = mysql_info();
$a_rows = mysql_affected_rows();
ereg("Rows matched: ([0-9]*)", $info_str, $r_matched);
return ($a_rows < 1)?($r_matched[1]?$r_matched[1]:0):$a_rows;
}


PS:因為這個小問題折騰了半天,感覺php真是太不清晰了
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 格尔木市| 泾阳县| 光泽县| 皋兰县| 南通市| 祥云县| 璧山县| 永春县| 新疆| 松阳县| 格尔木市| 西城区| 彰武县| 阿拉善右旗| 故城县| 茂名市| 汕尾市| 自治县| 师宗县| 巢湖市| 车险| 江华| 吉水县| 饶平县| 张北县| 景宁| 卓资县| 荥经县| 石渠县| 江安县| 安仁县| 武平县| 平山县| 赤城县| 枣阳市| 隆化县| 年辖:市辖区| 广州市| 九江市| 湘乡市| 民权县|