PHP Classes

File: usage.php

Recommend this page to a friend!
  Classes of Tufan Baris YILDIRIM   DB Engine   usage.php   Download  
File: usage.php
Role: Example script
Content type: text/plain
Description: Example basic using.
Class: DB Engine
Database abstraction layer for many databases
Author: By
Last change:
Date: 13 years ago
Size: 1,822 bytes
 

Contents

Class file image Download
<?php
 
include 'db_engine.php';
 
 
/**
  * Mysql Connection
  *
  * @var sqlEngine
  */
 
$mysql=new dbEngine(DB_MYSQL);
 
$mysql->connect('localhost','root','12345','ihale');
 
 
 
/**
  * Oracle Connecton
  *
  * @var sqlEngine
  */
 
$oracle=new dbEngine(DB_ORACLE);
 
$oracle->connect('rac1//rac1.world','HBYS','masterkey');
 
$oracle->count('patienst',"where name='TUFAN BARIS' and surname='YILDIRIM'");
 
 
 
 
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>D3 Grid Usage Example</title>
<meta name="description" content="Example about Sql Engine">
<meta name="author" content="Tufan Baris YILDIRIM">
<link href="img/d3_grid.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
  $mysql
->query("select * from firmalar limit 10");
 
     
/**
      * public $tableStart = "<table class=\"d3_grid\">\n",
      * $headerCellTemplate = '<td>{$caption}</td>',
      * $headerTemplate = "<tr>{\$header}</tr>\n",
      * $cellTemplate = '<td>{$cellValue}</td>',
      * $rowTemplate = "<tr>{\$cells}</tr>\n",
      * $tableEnd = "</table>",
      * $tableTemplate = '{$tableStart}{$content}{$tableEnd}',
      * $displayError = true;
      */
 
 
function rowStyler($ref){
      global
$mysql;
     
$mysql->grid()->rowTemplate='<tr class="row'.($ref['d3Rownum']%2).'">{$cells}</tr>'."\n";
  }
     

 
$mysql->grid()->captions=array('id'=>'S&#305;ra No');
 
$mysql->grid()->cellTemplate('id','<b>{$id}</b>');
 
$mysql->grid()->headerTemplate='<tr class="thead">{$header}</tr>';
 
$mysql->grid()->beforeRowPrint='rowStyler';
 
$mysql->grid()->nullValue='<span class="null">null</span>';
 
$mysql->grid()->build();
?>
</body>
</html>