search button and display the data in php

341 Views Asked by At

i would like to ask regarding the php code and oracle sql. I am developing a website for a system as my project task. for the searching page, user can fill in one of the searching field and the system will display all the required details based on what user search for. can anyone teach me on how to do the php code to link with the oracle SQL database. as what i have done so far is:

$sql = "SELECT * FROM sdlrules_tbl_wip_queue
        where lotid = trim(upper((:lotid)),
              eqpId = trim(upper(:eqpId)),
              stepName =  trim(:stepName),
              sequence = trim(:sequence)";

if($_REQUEST["lotId"]!=""){
        $sql .= "SELECT 
                LOTID,PLAN,STEPSEQ,STEPNAME,LOTTYPE,PRIORITY,DEVICE,EQPID,REMARK
                FROM
                sdlrules_tbl_wip_queue
                WHERE lotid = trim(upper(:lotid))";
}

if($_REQUEST["eqpId"]!=""){
        $sql = "SELECT * FROM sdlrules_tbl_wip_queue
                WHERE eqpId = ':eqpId'";
}

if($_REQUEST["stepName"]!=""){
        $sql = "SELECT * FROM sdlrules_tbl_wip_queue
                WHERE stepName = ':stepName'";
}

if($_REQUEST["sequence"]!==""){
        $sql = "SELECT * FROM sdlrules_tbl_wip_queue
                WHERE sequence = ':sequence'";
}
2

There are 2 best solutions below

0
On

can anyone teach me on how to do the php code to link with the oracle SQL database.

This is a broad question.

Oracle has two manuals you might want to check out

There is some older install content in these books you can skip, but there is much material that is useful.

0
On

You simply need to read following resources to connect to Oracle database and perform required operations. Just read functions descriptions. Its pretty straight forward.

http://php.net/manual/en/intro.oci8.php

http://php.net/manual/en/ref.oci8.php