作者toyhsu (至尊俠盜小短褲)
看板PHP
標題[請益] 有關smarty跟ADOdb的問題
時間Wed Jul 4 11:54:36 2012
簡單說明
我在html的語法應該沒問題 因為有讀到資料
但sumbit之後 到php要更新資料 執行UPDATE語法
就發現PHP執行完 無錯誤訊息 但SQL語法沒有執行成功 資料還是原來的樣子
不知道是不是array變數那邊有問題?
我自己對smarty跟ADOdb完全是新手 就不知道php語法要改成什麼樣 才是對的
煩請高手解答 謝謝
http://www.FunP.Net/89692 與下面相同 只是放在一個TXT中
下面是html的部份
<{section name=c loop=$arrList}>
<tr>
<td><input id="grpmbr_no>" name="grpmbr_no>" type="text" class="small"
value="<{$arrList[c].grpmbr_no}>"/> </td>
<td><input id="grpmbr_name>" name="grpmbr_name>" size="20" type="text"
value="<{$arrList[c].grpmbr_name}>" /></td>
<td><{if $arrList[c].grpmbr_sex == 1}>男<{else}>女<{/if}>/td>
<td><input id="grpmbr_birthday>" name="grpmbr_birthday>" size="10"
type="text" value="<{$arrList[c].grpmbr_birthday}>" /></td>
</tr>
<tr>
<td><input id="grpmbr_idcard>" name="grpmbr_idcard>" size="20" type="text"
value="<{$arrList[c].grpmbr_idcard}>" /></td>
<td><input id="grpmbr_unit>" name="grpmbr_unit>" size="20" type="text"
value="<{$arrList[c].grpmbr_unit}>" /></td>
<td><input id="grpmbr_tel>" name="grpmbr_tel>" size="20" type="text"
value="<{$arrList[c].grpmbr_tel}>" /></td>
<td><input id="grpmbr_email>" name="grpmbr_emai>" size="25" type="text"
value="<{$arrList[c].grpmbr_email}>" /></td>
</tr>
<{/section}>
下面是php的語法
for ( $i = 1;$i <= count($this->_HTML["arrList"]); $i++)
{
$record = array();
$record['grpmbr_no'] = $this->arrList[$i]['grpmbr_no']; //團體編號
$record['grpmbr_name'] = $this->arrList[$i]['grpmbr_name']; //姓名
$record['grpmbr_sex'] = $this->_HTML["arrList"][$i]['grpmbr_sex']; //性別
$record['grpmbr_birthday'] =
$this->_HTML["arrList"][$i]['grpmbr_birthday'];//生日
$record['grpmbr_idcard'] = $this->_HTML["arrList"][$i]['grpmbr_idcard']; //
身分證
$record['grpmbr_unit'] = $this->_HTML["arrList"][$i]['grpmbr_unit']; //服
務單位/學校
$record['grpmbr_tel'] = $this->_HTML["arrList"][$i]['grpmbr_tel']; //聯
絡電話
$record['grpmbr_email'] = $this->_HTML["arrList"][$i]['grpmbr_email'];
//email
$this->DB->AutoExecute("groupmember", $record, 'UPDATE', "grpmbr_no = '" .
$this->arrList[$i]['grpmbr_no'] . "'");
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.250.6.76
1F:→ kuAIpAI:你要不要給個錯誤訊息 或者敘述錯誤部份詳細點? 07/04 13:02
2F:→ toyhsu:沒錯誤訊息 但SQL語法沒執行成功 07/04 13:37
※ 編輯: toyhsu 來自: 111.250.6.76 (07/04 13:39)
※ 編輯: toyhsu 來自: 111.250.6.76 (07/04 13:57)
3F:→ kuAIpAI:先Var_dump(); 看有沒有資料傳過來? 07/04 18:17
4F:→ toyhsu:dump完 資料是NULL 囧 看來一開始就錯了.... 07/09 11:16