Can someone tell me what's wrong with this code

Can someone tell me what’s wrong with this code please

while ($lookrowinit = mysqli_fetch_array($qr_result))
{
	if ($lookrowinit['looktype'] == 'fieldname' && $lookrowinit['value'] != 'NA')
	{
		$_SESSION['fields'] = array(
			'value' => $lookrowinit['value'],
			'description' => $lookrowinit['description']);
		$a++;
	}
	elseif ($lookrowinit['value'] != 'NA')
	{
		$_SESSION['lookrow'] = array(
			'lookupid' => $lookrowinit['lookupid'],
			'looktype' => $lookrowinit['looktype'],
			'value' => $lookrowinit['value']);
		$b++;
	}
}

$_SESSION['numfields'] = count($_SESSION['fields']);
$_SESSION['passvar']['numrecs'] = count($_SESSION['lookrow']);

When I process it, $a = 8, $b = 45, $_SESSION[‘numfields’] = 2, $_SESSION[‘passvar’][‘numrecs’] = 3

Evidently you can’t assign an array dynamically to a session variable?

If I create the arrays ‘fields’ and ‘lookrow’ into regular variables and then set the session variables equal to them, and then do the count of the session variables, it works.