Home >Backend Development >PHP Tutorial >php +mysql mysql_fetch_lengths tutorial_PHP tutorial
The function of mysql_fetch_lengths is to determine the length of mysql_fetch_array ( ), mysql_fetch_assoc ( ), mysql_fetch_object ( ) or mysql_fetch_row ( ). If successful, return a display, otherwise return false;
Syntax of mysql_fetch_lengths.
mysql_fetch_lengths(data)
参数.
data:必选就是mysql_query返回的值
来我们来看看实例.
<?
$sql = "SELECT * from Person WHERE Lastname='Refsnes'";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_row($result));
print_r(mysql_fetch_lengths($result));
?>
输出结果.
<pre class="brush:php;toolbar:false">Array ( [0] => Refsnes [1] => Kai Jim [2] => Taugata 2 [3] => 22 )
Array ( [0] => 7 [1] => 7 [2] => 9 [3] => 2 )