简体   繁体   English

如何使用ORACLE(OCI)在SQL / PHP中执行更新查询

[英]How to do an update query in SQL/PHP with ORACLE(OCI)

I'm new to Oracle and using OCI with PHP. 我是Oracle的新手,并且使用OCI和PHP。 I've been doing ok until I've tried to do an update statement. 在我尝试做更新声明之前,我一直都很好。

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);

All I'm trying to do is and update statement so the user can change the Title of a person. 我所要做的就是更新语句,以便用户可以更改一个人的标题。 I am using AJAX to do this asynchronously and when the user attempts to change the title to the current value it processes the function fine but if the new value is different it gets stuck at the update statement and no change is made. 我正在使用AJAX异步执行此操作,当用户尝试将标题更改为当前值时,它会正常处理函数,但如果新值不同,则会卡在update语句中并且不会进行任何更改。

$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);

try this 试试这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM