Retrive Oracle data using PHP

<?php
$val='';
$val=$_POST['val'];
$conn=  oci_connect('hr', 'hr', 'orcl');

$sql="select employee_id,first_name,last_name,email,phone_number,hire_date,salary,b.department_name
    from employees a,departments b
    where a.department_id=b.department_id
    and (b.department_id ='{$val}' or '{$val}' is null)     [$val is for dynamic data search]
    order by 1";
$conn = oci_parse($conn,$sql );
oci_execute($conn);

?>


<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
   
    <body font-family="arial">
        <form action="" method="POST">
            <table align="center">
                <tr>
                    <td><input type="number" name="val"/></td>
                    <td><input type="submit" name="btn" value="Submit"/></td>
       </tr>
</table>
            </form>
        <table width="50%" align="center" border="2">
            <tr>
                <th>EMPLOYEE ID</th>
                <th>FIRST NAME</th>
                <th>LAST NAME</th>
                <th>EMAIL</th>
                <th>PHONE NUMBER</th>
                <th>HIRE DATE</th>
                <th>SALRAY</th>
                <th>DEPARTMENT NAME</th>
            </tr>
     <?php while (($row=  oci_fetch_array($conn,OCI_BOTH))!=FALSE){?>
            <tr>
                <td width="100px" align="center"><?php echo $row[0];?></td>
                <td width="300px"><?php echo $row[1];?></td>
                <td width="300px"><?php echo $row[2];?></td>
                <td width="300px"><?php echo $row[3];?></td>
                <td width="100px" align="right"><?php echo $row[4];?></td>
                <td width="100px" align="right"><?php echo $row[5];?></td>
                <td width="100px" align="right"><?php echo $row[6];?></td>
                <td width="100px" align="right"><?php echo $row[7];?></td>
            </tr>
            <?php }?>
        </table>
        <hr/>
        <p align="center"><strong>This is last section</strong></p>
        <hr/>
          
    </body>

</html>

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন