This shows you the differences between two versions of the page.
— |
kurs:employees.php [2014/12/09 12:26] (current) mh created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | <html> | ||
+ | <head> | ||
+ | <link rel="stylesheet" type="text/css" | ||
+ | href="bootstrap/dist/css/bootstrap.min.css"> | ||
+ | </head> | ||
+ | <h2>Addition</h2> | ||
+ | <?php if (empty($_GET)) { ?> | ||
+ | |||
+ | <form class="form-horizontal" role="form" action='employees.php' | ||
+ | method='get'> | ||
+ | <div class="form-group"> | ||
+ | <label for="last_name" class="col-sm-2 control-label">Last Name</label> | ||
+ | <input type="text" name="last_name"/><br> | ||
+ | </div> | ||
+ | <div class="col-sm-offset-2 col-sm-10"> | ||
+ | <input type="submit" value="Suchen" class="btn"/> | ||
+ | </div> | ||
+ | </form> | ||
+ | |||
+ | <?php | ||
+ | } else { | ||
+ | $last_name = $_GET['last_name']; | ||
+ | $db = oci_connect('hr', 'hr', 'kurs2.wifi'); | ||
+ | |||
+ | $q = oci_parse($db, | ||
+ | "select first_name, | ||
+ | last_name, | ||
+ | salary | ||
+ | from employees where last_name = :b_last_name"); | ||
+ | |||
+ | oci_bind_by_name($q, ":b_last_name", $last_name ); | ||
+ | |||
+ | $r = oci_execute($q, OCI_DEFAULT); | ||
+ | |||
+ | while ($row = oci_fetch_array($q, OCI_NUM)) { ?> | ||
+ | <div class="well col-sm-offset-2 col-sm-2"> | ||
+ | <?php | ||
+ | echo $row[0] .' '.$row[1].' '.$row[2]. "<br>\n"; | ||
+ | ?> | ||
+ | </div> | ||
+ | <?php | ||
+ | } | ||
+ | } | ||
+ | ?> | ||
+ | </ html> | ||
+ | </code> |