如何从php调用oracle函数

Can anyone guide me on how to call an oracle function in php?

I am working on a CRUD based web application and this is what I have done till now.

<div class="container">
    <div class="panel panel-default">
        <div class="panel-body">
    <div id="addroles" class="hide" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <div id="resultActivityContent"></div>
    </div>  
    <form class="cmxform" id="addroles">
        <legend>Add Roles</legend>
        <label for="names">Select Name</label>
        <select class="form-control" name="names" id="names">
           <option selected disabled></option>
           <?php 
           $dbUser = "";
            $dbPass = "";
            $dbConn = "(DESCRIPTION = (ADDRESS = (PROTOCOL=TCP)(HOST=  )(PORT=  ))(CONNECT_DATA=(SID=  )))"; 
            $conn = oci_connect($dbUser, $dbPass, $dbConn);
            $sql = oci_parse($conn, "SELECT PERSON.FNAME, PERSON.LNAME FROM PERSON");
            oci_execute($sql, OCI_DEFAULT);
            ?>
           <?php
              while (oci_fetch($sql))
                  { ?>
                echo '<option value="<?php echo oci_result($sql, 'FNAME', 'LNAME')?>"><?=oci_result($sql,'FNAME') ?><?=oci_result($sql,'LNAME') ?></option>  
            <?php   
        }?>
        </select>   
        <br>
        <br>
        <label for="role">Select Role</label>
         <select class="form-control" name="role" id="role">
           <option selected disabled></option>
           <?php 
           $dbUser = "  ";
            $dbPass = "  ";
            $dbConn = "(DESCRIPTION = (ADDRESS = (PROTOCOL=TCP)(HOST=  )(PORT=  ))(CONNECT_DATA=(SID=  )))"; 
            $conn = oci_connect($dbUser, $dbPass, $dbConn);
            $sql = oci_parse($conn, "SELECT ROLE.ROLEDESC FROM ROLE");
            oci_execute($sql, OCI_DEFAULT);
            ?>
           <?php
              while (oci_fetch($sql))
                  { ?>
                echo '<option value="<?php echo oci_result($sql, 'ROLEDESC')?>"><?=oci_result($sql,'ROLEDESC') ?></option>  
            <?php   
        }?>

        </select> 
        <br>
        <button class="btn btn-info btn-primary" type="submit">Add Role</button>
        <br>
        <br>
    </form>
            </div>
     </div>       
</div>

As you can see right now everything is in the same file, so I want to make a separate file for connection and another file for functions and call the respective function in this file.

dtjbcda841554
dtjbcda841554 也许看看docs.oracle.com/cd/E11882_01/appdev.112/e10811/toc.htm?另见oracle.com/technetwork/topics/php/...
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐