如何插入多个查询?

时间:2019-05-29 07:09:44

标签: php oracle

嗨,我正在寻找可以帮助我解决问题的人。我想将多个查询插入数据库。在此之前,我使用MYSQLI并成功,但是当我更改为OCI时失败了。

这是我的代码

<?php  

    //$id = 0;
    $name = $_POST['docname'];
    $pass = $_POST['docpass'];
    $ic = $_POST['docic'];
    $gender = $_POST['docgender'];
    $status = $_POST['docstatus'];
    $email = $_POST['docemail'];
    $address = $_POST['docaddress'];
    $phone = $_POST['docphone'];
    $pass = $_POST['docpass'];
    $confirmpass = $_POST['docconfirmpass'];
    $speaciality = $_POST['docspeaciality'];

    include_once ('dbconnect.php');

    $sql = "INSERT INTO STAFF(staffid, staffname, icnumber, staffgender, 
            staffstatus, staffemail, staffaddress, staffphonenumber, 
            password, confirmpass) VALUES (staffid_seq.NEXTVAL, '$name', 
            '$ic', '$gender', '$status', '$email',  '$address', '$phone', 
            '$pass', '$confirmpass')";
    $sql2 = "INSERT INTO doctor(staffid, doctorspeaciality) VALUES 
            (staffid_seq.CURVAL, '$speaciality')";

    $result = oci_parse($dbc, $sql);
    $result2 = oci_parse($dbc, $sql2);
    oci_execute($result && $result2);
?>

错误是:

Warning: oci_execute() expects parameter 1 to be resource, boolean given in .. 

0 个答案:

没有答案