【发布时间】:2011-10-23 10:02:18
【问题描述】:
您好,我有一个由用户订购的服务数组,如下所示 $_POST 打印值
Array
(
[compaignID] => 4
[totalChecked] => 3
[hear_about_us] => Google
[videolink] =>
[LinkedIn] => Array
(
[0] => 1
[1] => 1
[2] => http://developer.comoj.com
)
[Facebook] => Array
(
[0] =>
[1] =>
)
[Twitter] => Array
(
[0] =>
[1] =>
)
[YouTube] => Array
(
[0] => 2
[1] => 4
[2] => http://developer.comoj.com
)
[Coupon_Area] => Array
(
[0] =>
[1] =>
)
[Website] => Array
(
[0] =>
[1] =>
)
[Google_Map] => Array
(
[0] =>
[1] =>
)
[Email] => Array
(
[0] => 3
[1] => 8
[2] => http://developer.comoj.com
)
[Share_To_Social_Media] => Array
(
[0] =>
[1] =>
)
[btnSubmit] => Submit
)
我很困惑如何存储这些。我以 php 形式制作了这些数组,以使它们的组如下所示
订单输入字段
<input name="<?php echo $service; ?>[]" type="text" id="order<?php echo $service; ?>" size="4">
用于服务复选框以检查要使用的服务
<input name="<?php echo $service; ?>[]" type="checkbox" id="show<?php echo $service; ?>" value="<?php echo $serviceID; ?>" onclick="countChecked();">
对于服务 WebURL,下面的输入字段如
<input name="<?php echo $service; ?>[]" type="text" id="<?php echo $service; ?>" size="40">
我很困惑如何仅获取具有值的数组并仅存储这些服务的订单号,例如显示升序或降序以及针对每个选中复选框的 webrurl。
我很困惑如何循环并存储在 mysql 中。
请帮帮我。
非常感谢
【问题讨论】:
-
这完全取决于表的结构。发布一些架构,也许我们可以为您提供帮助。
-
我的表如下 SQL
CREATE TABLEtbl_page_links` (pageLinkIDbigint(20) NOT NULL AUTO_INCREMENT,compaignIDbigint(20) NOT NULL,serviceIDtinyint(4) NOT NULL ,webaddresstext NOT NULL,sordertinyint(4) NOT NULL DEFAULT '0',isActivetinyint(4) NOT NULL DEFAULT '0', 主键 (pageLinkID) ) ENGINE=MyISAM AUTO_INCREMENT=19默认字符集=latin1`