多个数组值存储

时间:2013-09-12 09:46:04

标签: php arrays

我想在数据库中存储多个数组值。请检查我的数组值

Array
(
[client] => 1
[country] => 88
[state] => 1417
[plant] => 1
[equipment] => Array
    (
        [0] => 18,19
    )

[toa_test] => Array
    (
        [0] => 1
        [1] => 2
    )

[toa_ref] => Array
    (
        [0] => astm-d-3612
        [1] => astm-d-3612
        [2] => 
        [3] => 
        [4] => 
        [5] => 
        [6] => 
        [7] => 
        [8] => 
        [9] => 
        [10] => 
        [11] => 
    )

[toa_frequency] => Array
    (
        [0] => daily
        [1] => daily
        [2] => 
        [3] => 
        [4] => 
        [5] => 
        [6] => 
        [7] => 
        [8] => 
        [9] => 
        [10] => 
        [11] => 
    )

我想要这样的商店数据 Id |客户|设备ID |测试名称|参考|频率| 1 | 1 | 18 | 1 | astm-d-3612 |日常 2 | 2 | 20 | 2 | IS:52 |每月

我该怎么做

2 个答案:

答案 0 :(得分:1)

如何序列化(http://php.net/manual/en/function.serialize.php)和数组,然后存储它

答案 1 :(得分:0)

查看Normalization的基础知识数组很可能被分成多个表,具有各种类型的关系(看起来你可能有一些一对多/多对多的关系)。 Here是一篇介绍性文章。在我看来,以序列化的方式存储它是一个不好的举动,因为你将无法搜索你存储的数据。