php – mysql_fetch_array和mysql_fetch_row之间的区别?

前端之家收集整理的这篇文章主要介绍了php – mysql_fetch_array和mysql_fetch_row之间的区别?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是 PHP用户的一个简单问题.我无法在 PHP中获得MysqL_fetch_array()和MysqL_fetch_row()之间的确切区别的原因是我一直在使用Java.

在我发布这个问题之前,我从Google收到了一些答案,但我发现他们有些混乱.我在互联网上发现的一些链接如下.

Answer 1

Answer 2

Answer 3

Answer 4

我从上面的答案中得不到准确的想法.那么他们之间究竟有什么区别呢?

documentation是很清楚的,你看过吗?
MysqL_fetch_array ( resource $result [,int $result_type = MysqL_BOTH ] )

Returns an array of strings that corresponds to the fetched row,or
FALSE if there are no more rows. The type of returned array depends on
how result_type is defined.
By using MysqL_BOTH (default),you’ll get
an array with both associative and number indices. Using MysqL_ASSOC,
you only get associative indices (as MysqL_fetch_assoc() works),[by] using
MysqL_NUM,you only get number indices (as MysqL_fetch_row() works)
.

MysqL_fetch_row ( resource $result )

Returns an numerical array of strings that corresponds to the fetched
row,or FALSE if there are no more rows.

MysqL_fetch_row() fetches one row of data from the result associated
with the specified result identifier. The row is returned as an array.
Each result column is stored in an array offset,starting at offset 0.

综上所述

MysqL_fetch_array($result,MysqL_ASSOC)= MysqL_fetch_assoc($result)
MysqL_fetch_array($result,MysqL_NUM)= MysqL_fetch_row($result)

MysqL_fetch_array($result)= MysqL_fetch_assoc($result)MysqL_fetch_row($result)

原文链接:https://www.f2er.com/php/138273.html

猜你在找的PHP相关文章