使用php在oracle数据库中没有更新数据

时间:2017-08-08 04:03:52

标签: php oracle

我正在使用带有PHP的oracle。我已插入数据,现在想要更新用户可用性列。我使用下面给出的代码,但我无法更新数据。数据保持不变。请帮帮我。

    <?php
    if(isset($_POST['available']))
    {
        var_dump($_POST);
       print_r($_POST);
        echo("in available");
        session_start();
        $user = $_SESSION["username"];
        include('connect.php');
        $sql = oci_parse($conn,"select * from userM where user_name = '$user'");
       $result =  oci_execute($sql);

       while(($row = oci_fetch_array($sql,OCI_BOTH)) != false )
      {
         $p_No = $row[0];
         $full_Name = $row[1];
         $user_name = $row[2];
         $email = $row[3];
         $department = $row[4];
          $desig = $row[5];
        }
        $avail = 1;
        $sql1 = "update userM where user_name = '$user'"."set (:p_No, :full_Name, :user_name, :email, :department, :designation, :avail)";
           $compiled = oci_parse($conn,$sql1);
          oci_bind_by_name($compiled, ':p_No', $p_No);
          oci_bind_by_name($compiled, ':full_Name', $full_Name);
          oci_bind_by_name($compiled, ':user_name', $user_name);
          oci_bind_by_name($compiled, ':email', $email);
          oci_bind_by_name($compiled, ':department', $department);
          oci_bind_by_name($compiled, ':designation', $desig);
          oci_bind_by_name($compiled, ':avail', $avail);
          oci_execute($compiled);
          oci_close($conn);
         header("location:register.php?msg=avail");
    }
   ?>

0 个答案:

没有答案