0

The Following Code is not Updating the records into Oracle Database. Can any one please help what exactly the cause behind this. If any other reason might be making problem please suggest. Thanks in advance

<?php
if(isset($_GET['submit'])) {
echo $sl_no = $_GET['sl_no'];
echo $subject = $_GET['subject'];


// update Subject
$str2 = "update application_form af set af.subject_code=:subject where   af.application_form_sl_no=:sl_no";
$stid_update2 = oci_parse($conn, $str2);
oci_bind_by_name($stid_update2, ":subject", $subject);
oci_bind_by_name($stid_update2, ":sl_no", $sl_no);
oci_execute($stid_update2);
$success2 = oci_commit($conn);

// send successful message

    if($success2)
    {
    echo "Form saved Successfully!!!";
    }
}   
?>
1
  • Are you getting an error? checkout oci_error Commented May 25, 2012 at 11:16

1 Answer 1

1

You didn't declare the $conn variable and connect to the database

$conn = oci_connect('hr', 'welcome', 'localhost/XE');

Resource: http://php.net/manual/en/function.oci-connect.php

Sign up to request clarification or add additional context in comments.

2 Comments

Indeed. OP, check your error-reporting is enabled, and that all warnings are written to the screen on your dev machine.
Thanks, and sorry to say that I have already have the code for connection in a different file and the codes for select query just above the code mentioned (which i did not typed here), are working fine. Just the update part is not working. Is any thing wrong with user privilege or connection protocol or COMMIT issue? I am well equipped with Mysql but in oracle db, though I have done with select queries but for updating records, I am new. Hope my words may help you to get my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.