PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Emmanuel Arana Corzo   iOracleDriver   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: This is just an example
Class: iOracleDriver
Oracle database access wrapper
Author: By
Last change:
Date: 18 years ago
Size: 939 bytes
 

Contents

Class file image Download
<?php
/**
 * example.php
 * @author Emmanuel Arana Corzo <emmanuel.arana@gmail.com>
 */

 
include("OracleDriver.class.php");
 include(
"OracleRecordset.class.php");
 
 if(!
defined("TNS")) { define("TNS", "localservice"); }
 if(!
defined("USER")) { define("USER", "system"); }
 if(!
defined("PASS")) { define("PASS", "manager"); }

 
$oci = new OracleDriver(TNS, USER, PASS);
?>
<html>
<head>
<title>This is just an example</title>
</head>
<body>
<?php
 $sql
= "SELECT campo1, campo2" . chr(13);
 
$sql .= "FROM tablas" . chr(13);
 
 if(
$oci->getConnStatus()) {
  
$rs = new OracleRecordset($oci->execute($sql));
   echo
"<table border='1'>" . chr(13);
   while(
$rs->fetch()) {
     echo
"<tr>";
     for(
$i = 0; $i < $rs->getNCols(); $i++) {
       echo
"<td>" . $rs->getResult($i + 1) . "</td>" . chr(13);
     }
     echo
"</tr>";
   }
   echo
"</table>" . chr(13);
   unset(
$rs);
 }
?>
</body>
</html>