下面有個方便的解決辦法,從官方munual上看到 bdobrica at gmail dot com 留言的: As a solution to the problem pointed in the post " /> 国产日产欧产精品推荐色,日韩欧美综合一区,天堂久久av

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php更新mysql后獲取影響的行數(shù)發(fā)生異常解決方法

從manual上知道了mysql_affected_rows函數(shù)當(dāng)UPDATE前后的數(shù)據(jù)一樣時會返回異常值,

下面有個方便的解決辦法,從官方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.
復(fù)制代碼 代碼如下:
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:因?yàn)檫@個小問題折騰了半天,感覺php真是太不清晰了

php技術(shù)php更新mysql后獲取影響的行數(shù)發(fā)生異常解決方法,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 鹤峰县| 蒙山县| 宁乡县| 安图县| 高安市| 涡阳县| 肇州县| 龙口市| 收藏| 齐齐哈尔市| 金寨县| 美姑县| 柳江县| 乌海市| 乌苏市| 休宁县| 渑池县| 名山县| 雷州市| 华坪县| 定日县| 沿河| 正阳县| 林口县| 肇源县| 乡宁县| 手游| 天等县| 当阳市| 深水埗区| 九台市| 禄劝| 长沙市| 夹江县| 海门市| 章丘市| 义乌市| 吉水县| 耿马| 达州市| 蒙山县|