使用 odbc_fetch_array 但得到的是 "arrayarrayarray "

Using odbc_fetch_array but got "arrayarrayarray "instead

我尝试使用 odbc_fetch_array 获取值并将它们转换为变量,但是当我尝试回显时它只是说“arrayarrayarray”

Array ( 
  [0] => Array ( [PKDSEQ] => 154604 ) 
  [1] => Array ( [PKDSEQ] => 154604 ) 
  [2] => Array ( [PKDSEQ] => 154529 ) 
  [3] => Array ( [PKDSEQ] => 161689 ) 
  [4] => Array ( [PKDSEQ] => 158940 ) 
  [5] => Array ( [PKDSEQ] => 155383 ) 
  [6] => Array ( [PKDSEQ] => 156247 ) 
  [7] => Array ( [PKDSEQ] => 158123 ) 
)

有没有办法将数组分成数字?

代码

  $PKDSEQ2 = array();
  $table4 = "SELECT [PKDSEQ] FROM [PWSWMS].[dbo].[tbTR_PACKD] WHERE [PKDSEQ] = '$PKDSEQRS5'";
  $RS4 = odbc_exec($connection2, $table4);

  while ($PKDSEQ2 = odbc_fetch_array($RS4)) {
    $PKDSEQ[] = $PKDSEQ2;
  }
}

print_r(array_values($PKDSEQ));

if(isset($_POST['QTYINPUT1'])) {
  $QTYINPUT1 = $_POST['QTYINPUT1'];
  $update = "UPDATE [PWSWMS].[dbo].[tbTR_PACKD] SET QTYPCK='$QTYINPUT1' WHERE [PKDSEQ]='$PKDSEQ[1]'";
  $result = odbc_exec($connection2, $update);
  echo "<br>$QTYINPUT1";
  echo "<br>$PKDSEQ[1]";
}

您在 $PKDSEQ 的每个条目中都有一个关联数组。因此,您需要引用要输出的数组的 属性 。由于数组恰好只有一个属性,所以选择起来很简单:

echo "<br>".$PKDSEQ[1]["PKDSEQ"];