gpt4 book ai didi

PHP 爆炸 group_concat

转载 作者:行者123 更新时间:2023-11-29 01:56:37 26 4
gpt4 key购买 nike

我如何分解 [group_concat(DISTINCT LineItem.ItemID)] => 600278,WH1502

我试过了,但什么也没显示

$result = mysqli_query($con,"SELECT ...")

while($row = mysqli_fetch_array($result)) {
$r = $row[LineItem.ItemID];
explode(',',$r);
}

也试过

$result = mysqli_query($con,"SELECT ...")

while($row = mysqli_fetch_array($result)) {
$r = $row[group_concat(DISTINCT LineItem.ItemID)];
explode(',',$r);
}

//数组

  Array ( 
[0] => XXOR001#
[CustomerID] => XXOR001#
[1] => XXXX INDUSTRIES
[Customer_Bill_Name] => XXX INDUSTRIES
[2] => WILL CALL [WhichShipVia] => WILL CALL [3] =>
[INV_POSOOrderNumber] => [4] => 2014-12-05
[ShipByDate] => 2014-12-05 [5] =>
[GoodThruDate] => [6] =>
[CustomerSONo] => [7] => 15001
[Reference] => 15001 [8] => 2014-11-17
[TransactionDate] => 2014-11-17 [9] => 1
[DistNumber] => 1
[10] => 30.0000000000000000000
[Quantity] => 30.0000000000000000000
[11] => 600278,WH1502
[group_concat(DISTINCT LineItem.ItemID)] => 600278,WH1502
[12] => ASSY400/60-15.5/14 TRCIMP 15.5X13 8-8 FLAT, BW (TW4155-2)
[SalesDescription] => ASSY400/60-15.5/14 TRCIMP 15.5X13 8-8 FLAT, BW (TW4155-2)
[13] => TW4155-2
[PartNumber] => TW4155-2 [14] => ASSY400/60-15.5/14W/WHL15.5X13
[ItemDescription] => ASSY400/60-15.5/14W/WHL15.5X13 )

最佳答案

我不确定您要做什么,但您可以尝试这样的操作来帮助提供代码的可见性:

while($row = mysqli_fetch_array($result)) { 
$r = $row[LineItem.ItemID];
$lineItemArray = explode(',',$r);
print_r($lineItemArray);
}

explode()根据分配的分隔符从字符串创建数组。考虑这个例子:

$r = '600278,WH1502';
$rarray = explode(',',$r);
print_r($rarray);

//Output:
Array
(
[0] => 600278
[1] => WH1502
)

See demo

关于PHP 爆炸 group_concat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27208631/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com