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

首頁 > 數據庫 > MySQL > 正文

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

2024-07-24 12:43:11
字體:
來源:轉載
供稿:網友
從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.
復制代碼 代碼如下:www.CuoXIn.com

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真是太不清晰了

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 印江| 射洪县| 仪陇县| 吉安县| 河北省| 保山市| 永新县| 石泉县| 大洼县| 紫金县| 宕昌县| 且末县| 永靖县| 濮阳市| 衢州市| 壶关县| 甘谷县| 阜城县| 扎囊县| 龙游县| 宜章县| 南阳市| 揭东县| 门源| 阿拉善右旗| 陆河县| 托里县| 崇文区| 沁水县| 儋州市| 长岛县| 马鞍山市| 自治县| 仁寿县| 肃北| 巴林右旗| 岱山县| 深泽县| 定襄县| 隆德县| 色达县|