嗨,我正在尋找關於如何最好地處理提交數據庫表的建議。建議用PHP提交數據表的設計
到目前爲止,我已經生成的重複行的數據,像這樣:
<table border=1>
<tr>
<th>Phone Number</th>
<th>Prefix CallerID with</th>
<th>Seconds to ring before<br/>reaching voicemail</th>
<th>Voice mailbox<br/>extension number</th>
<th>Notes</th>
</tr>
<?php
$id = 1;
foreach ($line_detail as $line){
echo '<tr>';
echo '<td>'.form::input($id.'_did', $line->did).'</td>';
echo '<td>'.form::input($id.'_cid_prefix', $line->cid_prefix).'</td>';
echo '<td>'.form::input(array($id.'_dial_timeput', 'size'=>15, 'maxlength'=>3), $line->dial_timeout).'</td>';
echo '<td>'.form::dropdown($id.'_extension', $phones, $line->voicemail).'</td>';
echo '<td>'.form::input($id.'_notes', $line->notes).'</td>';
echo "</tr>";
$id++;
}
?>
</table>
當我提出這個我有這樣的重複數據:
(array) Array
(
[1_did] => 64123456789
[1_cid_prefix] => DDI-
[1_extension] => 800
[1_notes] =>
[2_did] => 645678903
[2_cid_prefix] => TEST-
[2_extension] => 820
[2_notes] =>
[submit] => Save
)
好了,現在我可以按id將它們分組並向數據庫提交更新。 但是,我想知道是否有更好的方法來做到這一點。
感謝,這正是我需要。使它更簡單的工作。 – Matt 2010-06-23 23:53:53