Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

oracle connection using php

RobeenJul 21 2020 — edited Jul 23 2020

target DB: 11.2.0.4.0 oracle 64 bit

Red Hat Enterprise Linux Server release 6.8 (Santiago) 64 bit

source server: red hat 7.8

[root@rb-opdev-01 lampp]# ./lampp version

Version: XAMPP for Linux 7.4.7-0

Hello Team,

I am getting error below when connecting using the form below:

<form name="form1" method="post" action="login.php">

  <label> User Name

  <input type="text" name="nis" id="nis">

  </label>

  <label> Password

  <input type="password" name="password" id="password">

  </label>

  <label>

  <input type="submit" name="submit" id="button" value="Login">

  </label>

</form>

<?php

//create table users (userid varchar2(10), password varchar2(20), constraint pk_users primary key (userid));

//insert into users values('kharis', 'pass123');

$nis = isset($_POST['nis']) == true ? $_POST['nis'] : '';

$password= isset($_POST['password']) == true ? $_POST['password'] : '';

if(empty($nis) or empty($password)){

    echo "UserID Password blank";}

else

{

    $db = "(DESCRIPTION =

        (ADDRESS = (PROTOCOL = TCP)(HOST = rhis-gaia-rpt01.mtg.local)(PORT = 1521))

        (CONNECT_DATA =

          (SERVER = DEDICATED)

          (SERVICE_NAME =migr )

        )

      )" ;

    $connect = oci_connect("migr");

    $query = "SELECT * from users WHERE userid='".$nis."' and password='".$password."'";

    $result = oci_parse($connect, $query);

    oci_execute($result);

    $tmpcount = oci_fetch($result);

    if ($tmpcount==1) {

        echo "Login Success";}

    else

    {

        echo "Login Failed";

    }

}

?>

Fatal error: Uncaught Error: Call to undefined function oci_connect() in /opt/lampp/htdocs/login.php:20 Stack trace: #0 {main} thrown in /opt/lampp/htdocs/login.php on line 20

Kindly help me.

Regards,

Joe

Comments
Post Details
Added on Jul 21 2020
4 comments
1,473 views