search
HomeBackend DevelopmentPHP Tutorial通过PHP实现DataGrid功能_PHP

DataGrid

最近想做一个通过PHP实现DataGrid功能的东西,这样可以直接修改数据库中表的内容,而不用开发【新增数据页面】,【编辑页面】,于是乎在网上找了找,类似的东西也有几个,开源的、付费的都有,不过基本都是基于MySQL。由于需要连接Oracle所以从二次开发和页面样式来说个人觉得phpMyDataGrid还是比较好上手。本篇首先介绍基于MySQL的使用方法,再简单介绍对于Oracle连接(基于sqlrelay)的二次开发。

1. 创建测试数据库和表

以下为引用的内容:
<span style="COLOR: blue">create database </span>`guru`<span style="COLOR: gray">;</span>

<span style="COLOR: blue">USE </span>`guru`<span style="COLOR: gray">;</span>

<span style="COLOR: blue">CREATE TABLE </span>`employees` <span style="COLOR: gray">(
      </span>`id` <span style="COLOR: blue">int</span><span style="COLOR: gray">(</span>6<span style="COLOR: gray">) NOT NULL </span>auto_increment<span style="COLOR: gray">,
      </span>`name` <span style="COLOR: blue">char</span><span style="COLOR: gray">(</span>20<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span>`lastname` <span style="COLOR: blue">char</span><span style="COLOR: gray">(</span>20<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span>`salary` <span style="COLOR: blue">float default </span><span style="COLOR: gray">NULL,
      </span>`age` <span style="COLOR: blue">int</span><span style="COLOR: gray">(</span>2<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span>`afiliation` <span style="COLOR: blue">date default </span><span style="COLOR: gray">NULL,
      </span>`status` <span style="COLOR: blue">int</span><span style="COLOR: gray">(</span>1<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span>`active` <span style="COLOR: blue">tinyint</span><span style="COLOR: gray">(</span>1<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span>`workeddays` <span style="COLOR: blue">int</span><span style="COLOR: gray">(</span>2<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span>`photo` <span style="COLOR: blue">char</span><span style="COLOR: gray">(</span>30<span style="COLOR: gray">) </span><span style="COLOR: blue">default </span><span style="COLOR: gray">NULL,
      </span><span style="COLOR: blue">PRIMARY KEY  </span><span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">)
)</span>

<span style="COLOR: blue">insert into </span>`employees`
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">) 
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>1<span style="COLOR: gray">, </span><span style="COLOR: red">'Ana'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Trujillo'</span><span style="COLOR: gray">,</span>2000<span style="COLOR: gray">,</span>45<span style="COLOR: gray">, </span><span style="COLOR: red">'2005-05-13'</span><span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>10<span style="COLOR: gray">, </span><span style="COLOR: red">'1.jpg'</span><span style="COLOR: gray">);
</span><span style="COLOR: blue">insert into </span>`employees` 
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">)
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>2<span style="COLOR: gray">, </span><span style="COLOR: red">'Jennifer'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Aniston'</span><span style="COLOR: gray">,</span>3500<span style="COLOR: gray">,</span>23<span style="COLOR: gray">, </span><span style="COLOR: red">'2004-10-22'</span><span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>0<span style="COLOR: gray">,</span>0<span style="COLOR: gray">, </span><span style="COLOR: red">'2.jpg'</span><span style="COLOR: gray">);
</span><span style="COLOR: blue">insert into </span>`employees` 
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">)
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>3<span style="COLOR: gray">, </span><span style="COLOR: red">'Michael'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Norman'</span><span style="COLOR: gray">,</span>1200<span style="COLOR: gray">,</span>19<span style="COLOR: gray">, </span><span style="COLOR: red">'2007-01-10'</span><span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>5<span style="COLOR: gray">, </span><span style="COLOR: red">'3.jpg'</span><span style="COLOR: gray">);
</span><span style="COLOR: blue">insert into </span>`employees` 
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">)
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>4<span style="COLOR: gray">, </span><span style="COLOR: red">'Vanessa'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Black'</span><span style="COLOR: gray">,</span>6500<span style="COLOR: gray">,</span>31<span style="COLOR: gray">, </span><span style="COLOR: red">'2000-11-05'</span><span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>30<span style="COLOR: gray">, </span><span style="COLOR: red">'4.jpg'</span><span style="COLOR: gray">);
</span><span style="COLOR: blue">insert into </span>`employees` 
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">)
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>5<span style="COLOR: gray">, </span><span style="COLOR: red">'Michael'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Strauss'</span><span style="COLOR: gray">,</span>3200<span style="COLOR: gray">,</span>45<span style="COLOR: gray">, </span><span style="COLOR: red">'2006-10-21'</span><span style="COLOR: gray">,</span>2<span style="COLOR: gray">,</span>0<span style="COLOR: gray">,</span>22<span style="COLOR: gray">, </span><span style="COLOR: red">'5.jpg'</span><span style="COLOR: gray">);
</span><span style="COLOR: blue">insert into </span>`employees` 
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">)
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>6<span style="COLOR: gray">, </span><span style="COLOR: red">'William'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Brown'</span><span style="COLOR: gray">,</span>2300<span style="COLOR: gray">,</span>21<span style="COLOR: gray">, </span><span style="COLOR: red">'2001-03-10'</span><span style="COLOR: gray">,</span>3<span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>10<span style="COLOR: gray">, </span><span style="COLOR: red">'6.jpg'</span><span style="COLOR: gray">);
</span><span style="COLOR: blue">insert into </span>`employees` 
    <span style="COLOR: gray">(</span>`id`<span style="COLOR: gray">,</span>`name`<span style="COLOR: gray">,</span>`lastname`<span style="COLOR: gray">,</span>`salary`<span style="COLOR: gray">,</span>`age`<span style="COLOR: gray">,</span>`afiliation`<span style="COLOR: gray">,</span>`status`<span style="COLOR: gray">,</span>`active`<span style="COLOR: gray">,</span>`workeddays`<span style="COLOR: gray">,</span>`photo`<span style="COLOR: gray">)
    </span><span style="COLOR: blue">values </span><span style="COLOR: gray">(</span>7<span style="COLOR: gray">, </span><span style="COLOR: red">'Lucca'</span><span style="COLOR: gray">, </span><span style="COLOR: red">'Normany'</span><span style="COLOR: gray">,</span>2800<span style="COLOR: gray">,</span>36<span style="COLOR: gray">, </span><span style="COLOR: red">'2006-10-02'</span><span style="COLOR: gray">,</span>3<span style="COLOR: gray">,</span>1<span style="COLOR: gray">,</span>20<span style="COLOR: gray">, </span><span style="COLOR: red">'7.jpg'</span><span style="COLOR: gray">);</span>

2. PHP程序介绍

phpMyDataGrid主要是通过phpmydatagrid.class.php,dgscripts.js来实现的,总共加起来不到100kB,又是一个小巧的软件。对于这两个文件就不多讲了,感兴趣的同学可以“打包带走”回去慢慢品。主要介绍该软件的使用方法,即实例datagrid_for_mysql.php。先看一下页面示意图:

2009-8-11-19.22.06

以下为引用的内容:
<span style="COLOR: blue"><?php 
include </span><span style="COLOR: purple">(</span><span style="COLOR: olive">"phpmydatagrid.class.php"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">$objGrid </span><span style="COLOR: purple">= </span><span style="COLOR: blue">new </span>datagrid;

<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>closeTags<span style="COLOR: purple">(</span><span style="COLOR: blue">true</span><span style="COLOR: purple">)</span>;  
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>friendlyHTML<span style="COLOR: purple">()</span>;  
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>methodForm<span style="COLOR: purple">(</span><span style="COLOR: olive">"get"</span><span style="COLOR: purple">)</span>; 
<span style="COLOR: green">//连接数据库
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>conectadb<span style="COLOR: purple">(</span><span style="COLOR: olive">"127.0.0.1"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"root"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"root"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"guru"</span><span style="COLOR: purple">)</span>;<br /><span style="COLOR: green">//加密字符串
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>salt<span style="COLOR: purple">(</span><span style="COLOR: olive">"Myc0defor5tr0ng3r-Pro3EctiOn"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>language<span style="COLOR: purple">(</span><span style="COLOR: olive">"en"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//最后一列显示的功能键,从左向右功能为&ldquo;新增键&rdquo;、&ldquo;编辑键&rdquo;、&ldquo;删除键&rdquo;、&ldquo;浏览键&rdquo;。
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>buttons<span style="COLOR: purple">(</span><span style="COLOR: blue">true</span><span style="COLOR: purple">,</span><span style="COLOR: blue">true</span><span style="COLOR: purple">,</span><span style="COLOR: blue">true</span><span style="COLOR: purple">,</span><span style="COLOR: blue">true</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//修改数值时产生的Form名称
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>form<span style="COLOR: purple">(</span><span style="COLOR: olive">'employee'</span><span style="COLOR: purple">, </span><span style="COLOR: blue">true</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//可检索列名
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>searchby<span style="COLOR: purple">(</span><span style="COLOR: olive">"name,lastname"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//需要读取的表
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>tabla<span style="COLOR: purple">(</span><span style="COLOR: olive">"employees"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//索引值用于修改数据
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>keyfield<span style="COLOR: purple">(</span><span style="COLOR: olive">"id"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//分页显示行数
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>datarows<span style="COLOR: purple">(</span><span style="COLOR: red">20</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//默认排序方式
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>orderby<span style="COLOR: purple">(</span><span style="COLOR: olive">"name"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"ASC"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: green">//显示列设置,相关设置可参考phpmydatagrid.class.php
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"id"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"ID Employee"</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">1</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"50"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"center"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"integer"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"name"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Name"</span><span style="COLOR: purple">, </span><span style="COLOR: red">30</span><span style="COLOR: purple">, </span><span style="COLOR: red">30</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"150"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"left"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"lastname"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Last name"</span><span style="COLOR: purple">, </span><span style="COLOR: red">30</span><span style="COLOR: purple">, </span><span style="COLOR: red">30</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"150"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"left"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"age"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Age"</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"50"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"right"</span><span style="COLOR: purple">)</span>;<br /><span style="COLOR: green">//自定义日期格式
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"afiliation"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Afiliation Date"</span><span style="COLOR: purple">, </span><span style="COLOR: red">10</span><span style="COLOR: purple">, </span><span style="COLOR: red">10</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"100"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"center"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"date:dmy:/"</span><span style="COLOR: purple">)</span>;<br /><span style="COLOR: green">//编辑时可以自定义为<Select>模式</span>
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"status"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Status"</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"60"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"left"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"select:1_Single:2_Married:3_Divorced"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue"><span style="COLOR: green">//编辑时可以自定义为<CheckBox>模式</span>
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"active"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Active"</span><span style="COLOR: purple">, </span><span style="COLOR: red">2</span><span style="COLOR: purple">, </span><span style="COLOR: red">2</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">,</span><span style="COLOR: olive">"50"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"center"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"check:No:Yes"</span><span style="COLOR: purple">)</span>;<br /><span style="COLOR: green">//自定义货币显示形式</span>
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"salary"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Salary"</span><span style="COLOR: purple">, </span><span style="COLOR: red">10</span><span style="COLOR: purple">, </span><span style="COLOR: red">10</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"90"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"right"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"money:&euro;"</span><span style="COLOR: purple">)</span>;<br /><span style="COLOR: green">//将数据以柱状图显示</span>
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>FormatColumn<span style="COLOR: purple">(</span><span style="COLOR: olive">"workeddays"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"Work days"</span><span style="COLOR: purple">, </span><span style="COLOR: red">5</span><span style="COLOR: purple">, </span><span style="COLOR: red">2</span><span style="COLOR: purple">, </span><span style="COLOR: red">0</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"50"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"right"</span><span style="COLOR: purple">, </span><span style="COLOR: olive">"chart:percent:val:31"</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>checkable<span style="COLOR: purple">()</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>setHeader<span style="COLOR: purple">()</span>;
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>ajax<span style="COLOR: purple">(</span><span style="COLOR: olive">'silent'</span><span style="COLOR: purple">)</span>;
<span style="COLOR: blue">echo </span><span style="COLOR: olive">'<html>
      <head><title>PHPDataGrid</title></head>
      <body><div align="center"><br />'</span>;
<span style="COLOR: green">//生成DataGrid
</span><span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>grid<span style="COLOR: purple">()</span>;
<span style="COLOR: blue">echo </span><span style="COLOR: olive">'</div></body></html>'</span>;<br /><span style="COLOR: green">//关闭数据库连接</span>
<span style="COLOR: blue">$objGrid</span><span style="COLOR: purple">-></span>desconectar<span style="COLOR: purple">()</span>;
<span style="COLOR: blue">?></span>

3. 基于Oracle简介

对于Oracle的读取主要是把phpmydatagrid.class.php中与MySQL连接的函数修改为Oracle,本篇是通过sqlrelay(可参考http://sqlrelay.sourceforge.net/)进行的Oracle连接,当然也可以使用PHP自带的OCI8模块(效率有些低),修改后另存为phporadatagrid.class.php即可在其他程序(datagrid_for_oracle.php)中调用。以上涉及的所有程序均可在压缩包中找到。

希望对大家有用!

http://cid-c75f4e27adfe5bbc.skydrive.live.com/embedrowdetail.aspx/GnieTech/phpMyDataGrid.zip

作者: Gnie

出处: {GnieTech} (http://www.cnblogs.com/gnielee/)

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, ReactBuild a React App With a Laravel Back End: Part 2, ReactMar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Notifications in LaravelNotifications in LaravelMar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

Explain the concept of late static binding in PHP.Explain the concept of late static binding in PHP.Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log AnalysisPHP Logging: Best Practices for PHP Log AnalysisMar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)