User Tools

Site Tools


kurs:pear-db.php

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
kurs:pear-db.php [2008/12/11 10:59]
mh
kurs:pear-db.php [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +<?php
 +include_once('​DB.php'​); ​
  
 +define("​NR_DB_CONNECTION",'​oci8://​hr:​hr@orcl11'​);​
 +
 +$dbh = DB::​connect(NR_DB_CONNECTION);​
 +
 +
 +// prepare statment
 +$stmt = "​SELECT first_name, last_name FROM employees";​
 +
 +$result=$dbh->​query($stmt);​
 +
 +$mode = DB_FETCHMODE_ASSOC;​
 +
 +while ($row = $result->​fetchRow($mode)){
 + print "<​pre>";​
 + print_r($row);​
 + print "</​pre>";​
 +}
 +
 +// Database disconnect
 +$result->​free();​
 +$dbh->​disconnect();​
 +?>
 +</​code>​