我有这个查询。where 子句是一个数组,它工作正常。
我需要计算返回的单独数组的数量,有什么办法可以做到这一点,
输出为:
数组([0] => 64)数组([0] => 64 [1] => 65)。
////////////////////////////////////////////////////
$message = explode(",", $message_arrayME);
////////////////////////////////////////////////////
$i = 0;
foreach ($message as $key => $value) {
$i++; // increment $i by one each loop pass
////////////////////////////////////////////////////
$q = mysqli_prepare($conn, ' SELECT member_id FROM members WHERE message_id=? ');
mysqli_stmt_bind_param($q, 's', $value);
mysqli_stmt_execute($q);
mysqli_stmt_store_result($q);
//$friendNumResult =mysqli_stmt_num_rows($q);
mysqli_stmt_bind_result($q, $memberId);
while($row = mysqli_stmt_fetch($q)):
$messageArrayNumResult[] = '
'.$memberId.'
';
endwhile; mysqli_stmt_close($q);
//echo $memberIdArray;
//$friendCount = count($memberIdArray);
//print_r($memberId);
$messageArray2 = implode(",",$messageArrayNumResult);
print_r( $messageArrayNumResult);
}
解决它:
$friendNum1 = implode(",", $messageArrayNumResult);
$friendNum2 = explode(",", $friendNum1 );
$friendCount= count($friendNum2);}
傻我:)