Home >Backend Development >PHP Tutorial >数组插入MYSQL数据库,只能插入最后一行数据,是咋回事

数组插入MYSQL数据库,只能插入最后一行数据,是咋回事

WBOY
WBOYOriginal
2016-06-13 11:15:071164browse

数组插入MYSQL数据库,只能插入最后一行数据,是怎么回事?

本帖最后由 oShanZhiYi 于 2013-02-22 19:49:38 编辑 各位大大你们好,小弟刚刚接触PHP,数组插入数据库实在是搞不定啊,请大家看看怎么回事,我打印了一下,发现各字段都已数组POST过来了,但是插入数据库的时候只能插入最后一行的数据,也没有报错!
表单页面:
<br><?php <br />$dingdanhao = date("y-m-dH-i-s");<br>$dingdanhao = str_replace("-","",$dingdanhao);<br>$dingdanhao .= rand(10,99);<br>$wm = "WM";<br>$orderid= $wm.$dingdanhao;<br>?><br><br><br><br><br><br><title>网站管理</title><br><meta><br><script></script><br><script><br /> var i=1<br /> function insert_row(){<br />  i ++<br />  R = tbl.insertRow()<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"kfname[]"+" style="+"width:50px;font-size: 12px; text-align:center"+" >"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"fcair[]"+" style="+"width:50px;font-size: 12px; text-align:center"+" >"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"fctime[]"+" style="+"width:100px;font-size: 12px; text-align:center"+" onclick="+"WdatePicker({dateFmt:\'MM月dd号 HH:mm\',lang:'zh-cn'})"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"cfair[]"+" style="+"width:60px;font-size: 12px; text-align:center"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"ddtime[]"+" style="+"width:100px;font-size: 12px; text-align:center"+" onclick="+"WdatePicker({dateFmt:\'dd号 HH:mm\',lang:'zh-cn'})"+" >"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"cftime[]"+" style="+"width:50px;font-size: 12px; text-align:center"+" >"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"dddi[]"+" style="+"width:50px;font-size: 12px; text-align:center"+" >"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"cfdi[]"+" style="+"width:50px;font-size: 12px; text-align:center"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"cfriqi[]"+" style="+"width:100px;font-size: 12px; text-align:center"+" class="+"Wdate"+" onFocus="+"WdatePicker({isShowClear:false,skin:'whyGreen',lang:'zh-cn'})"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"line[]"+" style="+"width:90px;font-size: 12px; text-align:center"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"price[]"+" style="+"width:50px;font-size: 12px; text-align:center"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"shouji[]"+" style="+"width:90px;font-size: 12px; text-align:center"+">"<br />  C = R.insertCell()<br />  C.innerHTML = "<input type="+"text"+" name="+"sex[]"+" style="+"width:40px;font-size: 12px; text-align:center"+">"<div class="clear">
                 
              
              
        
            </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn