希望你好。我有一个查询,结果如下:
我需要这是一个多数组来将它显示在数据表中,如下所示:
Article, Products, Supname, Week1, Week2, Week3, Week4, Week5, Week6, and so on
1 Product 1 Supplier 1 0,27 0,6 0,36 0,58 0,78 0,32 and so on
我用 PDO 得到了所有结果,因为我们使用的是 SQL 服务器,我创建数组的代码是这样的:
$pos = 0;
$x = 0;
$End = count($getAll);
$html = array();
$html2 = array();
while ($x <= 53) {
if ($x == 0) {
$html[] = array('Articleno' => $getAll[$pos+1]["ArtNo"], 'Name' => ''.$getAll[$pos+1]["Product"], 'Supname' => $getAll[$pos+1]["Levnamn"]);
}
$html2 = array('M'.$getAll[$pos]["Weekno"] => $getAll[$pos]["Qty"].' , '.$getAll[$pos]["Sold"]);
$html = array_merge($html, $html2);
$x++;
$pos++;
if ($x == 53){
$x=0;
}
if ($pos==$End){
$x=70;
}
}
结果还差得远,我尝试了很多不同的解决方案,但这是最接近的一个。我缺少 product2 的 alla 周信息。最多可填充 150 种产品。
有什么建议 ?
慕盖茨4494581