Home > Backend Development > PHP Tutorial > php操作mysql_fetch_row跟mysql_fetch_assoc 的一行不理解哎

php操作mysql_fetch_row跟mysql_fetch_assoc 的一行不理解哎

WBOY
Release: 2016-06-13 12:20:17
Original
958 people have browsed it

php操作mysql_fetch_row和mysql_fetch_assoc 的一行不理解哎

mysql_fetch_assoc — 从结果集中取得一行作为关联数组 
mysql_fetch_row — 从结果集中取得一行作为枚举数组 
从结果集中取得一行 这一行是结果集中第一行 还是随机一行?
------解决思路----------------------
mysql_fetch_assoc — 返回array(array('id'=>2,'name'=>'abc', 'sex'=>0));
mysql_fetch_row — 返回array(array(2,'abc', 0));

懂了吗
------解决思路----------------------
从指针的位置取一行啊,取完之后指针++。
结果集中所有行都取完了,如果要再次取第一行,需要指针恢复到第0行,mysql_data_seek
------解决思路----------------------
都是从结果集中取得第一行数据,不是随机取得!

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