[請益] PHP使用oci函數寫資料入oracle資料庫的問題

看板PHP作者 (ptt訪客)時間16年前 (2009/09/03 10:21), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
程式如下: $c = OCILogon('帳', '密', '//ip位置/資料庫名稱'); $query="INSERT into webmed(no,chname,enname,seno,compo,guide,feature,indication,admin,attention, conserve,sideeffect,corelation,he_restrict) values('$no','$chname','$enname','$seno','$compo', '$guide','$feature','$indication','$admin','$attention', '$conserve','$sideeffect','$corelation','$he_restrict')"; $stid = OCIParse($c, $query); OCIExecute($stid, OCI_DEFAULT); $committed = oci_commit($c); if (!$committed) { $error = oci_error($conn); echo 'Commit failed. Oracle reports: ' . $error['message']; } else{ echo "新增修改ok"; } 但committed只是確認SQL有沒有被執行,若像 Warning: ociexecute() [function.ociexecute]: ORA-01704: string literal too long in C:\website\med\medpost.php on line 43 等這類問題,它還是會執行esle顯示新增修改ok,我要用什麼函數來控制當有warning的 訊息,只顯示warning的訊息。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.117.124.224

09/03 16:27, , 1F
問題是警告的是OCIExecute你判斷的是 oci_commit
09/03 16:27, 1F
文章代碼(AID): #1AdoWjog (PHP)
文章代碼(AID): #1AdoWjog (PHP)