CSV来自嵌套数组

时间:2016-06-22 00:13:49

标签: php arrays medoo

使用Medoo高级时选择如下:

$medoo->query('SQL Goes HERE')->fetchAll();

结果以下列结构返回:

Array ( 
    [0] => Array ( 
        [Column 0 name] => "VALUE OF Record 0, Column 0" 
        [0] => "VALUE OF Record 0, Column 0" 
        [Column 1 name] => "VALUE OF Record 0, Column 1" 
        [1] => "VALUE OF Record 0, Column 1"
        ...
        ...
        [Column 99 name] => "VALUE OF Record 0, Column 99" 
        [99] => "VALUE OF Record 0, Column 99"
        ) 
    [1] => Array ( 
        [Column 0 name] => "VALUE OF Record 1, Column 0" 
        [0] => "VALUE OF Record 1, Column 0" 
        [Column 1 name] => "VALUE OF Record 1, Column 1" 
        [1] => "VALUE OF Record 1, Column 1"
        ...
        ...
        [Column 99 name] => "VALUE OF Record 1, Column 99" 
        [99] => "VALUE OF Record 1, Column 99"
        )
    ...
    ...
    ... 
    [99] => Array ( 
        [Column 0 name] => "VALUE OF Record 99, Column 0" 
        [0] => "VALUE OF Record 99, Column 0" 
        [Column 1 name] => "VALUE OF Record 99, Column 1" 
        [1] => "VALUE OF Record 99, Column 1"
        ...
        ...
        [Column 99 name] => "VALUE OF Record 99, Column 99" 
        [99] => "VALUE OF Record 99, Column 99"
        )
)

由于某种原因,每个数组都有一个关联键和索引键值对,而不是100%为什么以这种方式构建它。关于如何删除所有索引结果并仅保留关联数组的任何建议?

2 个答案:

答案 0 :(得分:1)

fetchAll需要正确填写:

$medoo->query('Query String')->fetchAll(PDO::FETCH_ASSOC);

答案 1 :(得分:0)

你可能需要这些方面的东西。这是假设您概述的数据类型是准确的

Base SDK