Home > Backend Development > PHP Tutorial > mysql_affected_rows的疑惑

mysql_affected_rows的疑惑

WBOY
Release: 2016-06-13 11:28:51
Original
1639 people have browsed it

mysql_affected_rows的困惑
手册上说:
mysql_affected_rows
取得最近一次与 link_identifier 关联的 INSERT,UPDATE 或 DELETE 查询所影响的记录行数。如果是SELECT 查询则使用mysql_num_rows()
但是为什么执行select的时候使用mysql_affected_rows也OK呢?

<br />$sql="select id,name,age,sex from xtable";<br />$result=mysql_query($sql);<br />$rows = mysql_affected_rows();<br />if($result && $rows ){<br />    var_dump($rows);//输出结果的确是查询到的结果的行数<br />}
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template