User Tools

Site Tools


kurs:list-table.php

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
kurs:list-table.php [2009/11/18 16:27]
mh
kurs:list-table.php [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +<?php
  
 +$db = oci_connect('​hr',​ '​hr',​ '​orcl'​);​
 +
 +$q = oci_parse($db,​ "​select * from employees"​);​
 +
 +$r = oci_execute($q,​ OCI_DEFAULT);​
 +
 +print "​Return $r\n";
 +
 +$ncols = oci_num_fields($q);​
 +
 +print "<​table border=1>​\n";​
 +echo "<​tr>";​
 +for ($i = 1; $i <= $ncols; $i++) {
 +    $column_name ​ = oci_field_name($q,​ $i);    ​
 +    echo "<​td>​$column_name</​td>";​
 +}
 +echo "</​tr>";​
 +
 +while ($row = oci_fetch_array($q,​ OCI_ASSOC+OCI_RETURN_NULLS)) {
 +  print "<​tr>​\n";​
 +  foreach ($row as $zellen) {
 +    if (!isset($zellen)) { $zellen = "​_";​ }
 +    print "<​td>​ $zellen </td> ";
 +  }
 +  print "</​tr>​\n";​
 +}
 +print "</​table>​\n";​
 +
 +
 +?>
 +</​code>​
kurs/list-table.php.txt ยท Last modified: 2014/09/10 21:22 (external edit)