我是Oracle新手,并且将OCI与PHP结合使用.在尝试执行更新语句之前,我一直做得很好.
include("ORCLconfig.php");
$updateTitleInserted = oci_parse($conn, "UPDATE insured SET INSURED_TITLE=
'$updateTitle' WHERE INSURED_ID='$INSURED_ID'");
oci_execute($updateTitleInserted, OCI_COMMIT_ON_SUCCESS);
oci_free_statement($updateTitleInserted);
oci_close($conn);
我要做的就是更新语句,以便用户可以更改人员的头衔.我正在使用AJAX异步执行此操作,并且当用户尝试将标题更改为当前值时,它会很好地处理函数,但是如果新值不同,则会卡在更新语句中,并且不会进行更改.
解决方法:
$c = oci_connect($userName, $password, "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =$serverName)(PORT = 1521)))(CONNECT_DATA=(SID=$databaseName)))");
$strQuery = "UPDATE table SET field = :xx WHERE ID = 123"
$stmt = OCIParse($c, $strQuery);
OCIBindByName($stmt, ':xx', $fieldval);
$ok = OCIExecute($stmt);
尝试这个