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 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)