User Tools

Site Tools


kurs:get_emp_by_name2.php

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
kurs:get_emp_by_name2.php [2009/11/26 09:58]
mh created
kurs:get_emp_by_name2.php [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +<?php
 +print "<​h2>​request</​h2>​\n";​
 +print_r($_REQUEST);​
  
 +if ($_REQUEST['​cmd'​] != '​getemp'​) {
 +$html=<<<​BLAB
 +<form name="​get_emp_by_name" ​
 +      action=$_SERVER[PHP_SELF]
 +   method="​get">​
 +<input name="​cmd"​ type="​hidden"​ value="​getemp">​
 +First Name:<​input name="​first_name"​ type="​text"​ size="​30"><​br>​
 +Last Name:<​input name="​last_name"​ type="​text"​ size="​30"><​br>​
 +<input type="​submit"​ value="​Get Employee">​
 +</​form>​
 +BLAB;
 +
 +print $html;
 +
 +} else {
 +include_once "​functions.php";​
 +
 +$db = dbconnect();​
 +$sql3 = 
 +   '​select * from employees where 
 +     ​last_name ​ = :last_name and
 + first_name = :​first_name';​
 +
 +$q = oci_parse($db,​ $sql3);
 +oci_bind_by_name($q,​ ":​last_name",​ $_REQUEST['​last_name'​],​-1, ​
 +                 ​SQLT_CHR );
 +
 +oci_bind_by_name($q,​ ":​first_name",​ $_REQUEST['​first_name'​],​-1,​
 +                 ​SQLT_CHR );
 +   ​
 +$r = oci_execute($q,​ OCI_DEFAULT);​
 +
 +$table[] = oci_fetch_array($q,​ OCI_ASSOC+OCI_RETURN_NULLS);​
 +
 +print_table($table);​
 +}
 +
 +?>
 +</​code>​