【发布时间】:2016-05-26 06:00:51
【问题描述】:
我有一个数组包含动态生成的文本框值的结果集。
在下面的示例中,我创建了三个动态生成的行,每行包含 6 个文本字段。为了区分每个行名称,我添加了行 ID 作为名称的最后一个单词。示例 ClaimExecutionCountry1 表示 ClaimExecutionCountry 作为名称,1 是行 ID。
Array
(
[0] => ClaimExecutionCountry1=10
[1] => activitystartdate1=05-27-2016
[2] => activityenddate1=06-24-2016
[3] => CLCode1=CLC1
[4] => SCSCode1=SCS1
[5] => fileName1=calc2.png
[6] => ClaimExecutionCountry2=53
[7] => activitystartdate2=05-27-2016
[8] => activityenddate2=05-28-2016
[9] => CLCode2=
[10] => SCSCode2=
[11] => fileName2=gh.png
[12] => ClaimExecutionCountry3=82
[13] => activitystartdate3=05-26-2016
[14] => activityenddate3=07-28-2016
[15] => CLCode3=
[16] => SCSCode3=SCS5
[17] => fileName3=preview1.png
)
我在将这些值存储在数据库中时遇到了一个问题。在我的数据库结构如下
Id | ClaimExecutionCountry | activitystartdate | activityenddate | CLCode | SCSCode | fileName
我需要在此表中存储= 之后的符号值。
插入表格后,结果为
Id | ClaimExecutionCountry | activitystartdate | activityenddate | CLCode | SCSCode | fileName
------------------------------------------------------------------------------------------------------------
1 | 10 | 05-27-2016 | 06-24-2016 | CLC1 | SCS1 | calc2.png
2 | 53 | 05-27-2016 | 05-28-2016 | null | null | gh.png
3 | 82 | 05-26-2016 | 07-28-2016 | null | SCS5 | preview1.png
所以请任何人帮助我使用上述格式将数组值存储在数据库中。我想你理解我的问题。我正在使用 PHP、codignator 和 MySql 作为数据库。在此先感谢
【问题讨论】:
-
到目前为止你有什么尝试??
-
我尝试了许多选项,例如将结果分解为数组并基于计数(在示例中计数为 3)我放入 for 循环。在循环中,我试图分隔每一行。但不工作。
标签: php mysql codeigniter