简体   繁体   中英

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

I'm new to Oracle and using OCI with 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.

$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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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