Php 数组的计数长度

Php 数组的计数长度,php,mysqli,Php,Mysqli,我必须得到整个专栏的长度。我正在做这样的事情: $allThumbnailName="Select sp_thumbnailName from stitchedproduct"; if($connection === false) { echo "Error in connection mysql_error()"; } $ATName = mysqli_query($connection,$allThumbnailName) or die(mysqli_error($connec

我必须得到整个专栏的长度。我正在做这样的事情:

$allThumbnailName="Select sp_thumbnailName from stitchedproduct";

if($connection === false) 
{
    echo "Error in connection mysql_error()";
}

$ATName = mysqli_query($connection,$allThumbnailName) or die(mysqli_error($connection));

if (!$ATName) echo "hello";

$ResultAllThumbnailName = mysqli_fetch_array($ATName);
$LengthOFarrayImages = count($ResultAllThumbnailName);

echo $LengthOFarrayImages;
代码返回长度为2,但我的列中有5个元素。

根据PHP
mysqli\u fetch\u数组
从结果集中只给出一行

while($ResultAllThumbnailName = mysqli_fetch_array($ATName))
{
  $rows[] = $ResultAllThumbnailName;
}


count($rows); // will give you whole length
但是如果你只想找一段时间,你会找到工作的

例如:

$row_cnt = mysqli_num_rows($ResultAllThumbnailName);

希望这会有所帮助

在您实际将所有行加载到php之前,有一个函数用于此:

在MySQL中使用。结果保存在内存中,true.)