$datas = array();
while($row = mysql_fetch_array($firstQueryResult)) {
$phones["Id"] = $row['person_id'];
$phones["Latitude"] = $row['lat'];
$phones["Longitude"] = $row['lng'];
$phones["Distance"] = $row['distance'];
$phones["DateTime"] = $row['location_datetime'];
$datas["mydata"][] = $phones;
}
echo "Count = ".count($datas); // always returning 1 while i have more than 1 recor
echo "Count = ".sizeof($datas); // always returning 1 while i have more than 1 record
任何人都可以帮助我。
答案 0 :(得分:4)
试试这个
echo "Count = ".count($datas['mydata']);
echo "Count = ".sizeof($datas['mydata']);
答案 1 :(得分:0)
$ datas只有1个元素 - > “MYDATA”。
您想要计算mydata中的条目数,所以:
count($datas["mydata"]);