duangewu5234 2017-08-03 10:15
浏览 54

无法使用php从oracle数据库中删除数据

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

        ?>
  • 写回答

1条回答 默认 最新

  • drtoclr046994545 2017-08-05 02:51
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程