PHP调用三种数据库的方法(3)
Oracle(甲骨文)是世界上最为流行的关系数据库。它是大公司推崇的工业化的强有力的引擎。我们先看看其相关的函数:
(1)integer ora_logon(string user , string password)
开始对一个Oracle数据库服务器的连接。
(2)integer ora_open(integer connection)
打开给出的连接的游标。
(3)integer ora_do(integer connection, string query)
在给出的连接上执行查询。PHP生成一个指示器,解析查询,并执行之。
(4)integer ora_parse(integer cursor, string query)
解析一个查询并准备好执行。
(5)boolean ora_exec(integer cursor)
执行一个先前由ora_parse函数解析过的查询。
(6)boolean ora_fetch(integer cursor)
此函数会使得一个执行过的查询中的行被取到指示器中。这使得您可以调用ora_getcolumn函数。
(7)string ora_getcolumn(integer cursor, integer column)
返回当前的值。列由零开始的数字索引。
(8)boolean ora_logoff(integer connection)
断开对数据库服务器的链接。
以下是向ORACLE数据库插入数据的示例程序:
//先设置两个环境变量ORACLE_HOME,ORACLE_SID
putenv("ORACLE_HOME=/oracle/app/oracle/product/8.0.4");
putenv("ORACLE_SID=ora8");
//设置网页显示中文
putenv("NLS_LANG=Simplified_Chinese.zhs16cgb231280");
if($connection=ora_logon("scott","tiger")) {
//库表test有ID,name,Description三项
$sql = 'insert into test(ID,name,Description) values ';
$sql .= '('' . $ID . '','' . $name . '',''. $Description . '')';
if($cursor=ora_do($connect,$sql)) {
print("insert finished!");
}
$query = 'select * from test';
if($cursor=ora_do($connect,$query)) {
ora_fetch($cursor);
$content0=ora_getcolumn($cursor,0);
$content1=ora_getcolumn($cursor,1);
$content2=ora_getcolumn($cursor,2);
print("$content0");
print("$content1");
print("$content2");
ora_close($cursor);
}
ora_logoff($connection);
}
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an
