1

I am using php to delete data from the database but its not deleting and there is no error showing.

Please help me.

<?php
    include('connect.php');
    $p_No = $_POST['p_No'];
    $sql2 = "DELETE FROM usersR WHERE p_No = '$p_No'";
    $compiled1 = oci_parse($conn,$sql2);
    $ex = oci_execute($compiled1,OCI_DEFAULT);
?>

Its my connect.php code

 <?php
       $username = "system";
       $password = "******";
       $connectionString = "localhost/ORCL";

       $conn = oci_connect($username, $password, $connectionString);
       if (!$conn) {
          $e = oci_error();
          trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
          }

        ?>
Nida Akram
  • 332
  • 2
  • 9
  • 24

1 Answers1

0

From the manual:

OCI_NO_AUTO_COMMIT: Do not automatically commit changes. Prior to PHP 5.3.2 (PECL OCI8 1.4) use OCI_DEFAULT which is equivalent to OCI_NO_AUTO_COMMIT.

So, you should be using OCI_COMMIT_ON_SUCCESS or doing an explicit commit.

To emphasize the comments everyone's made: add error checking and use bind variables to prevent SQL Injection.

When in doubt read the PHP OCI8 manual and also the Underground PHP & Oracle Manual, which I keep linking to because it is really a big FAQ.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48