关 键 词:
方法 数据库 调用 integer cursor name 一个 执行 connection
(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数据库插入数据的示例程序:
<html>
<head><title>向ORACLE数据库中插入数据</title></head>
<body>
<form action="<?echo $PHP_SELF;?>" method="post">
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<th>ID</th>
<th>name</th>
<th>Description</th>
</tr>
<tr>
<td><input type="text" name="name" maxlength="50" size="10"></td>
<td><input type="text" name="email" maxlength="255" size="30"></td>
<td><input type="text" name="Description" maxlength="255" size="50"></td>
</tr>
<tr align="center">
<td colspan="3"><input type="submit" value="提交"> <input type="reset" value="重写"></td>
</tr>
</table>
</form>
<?
//先设置两个环境变量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);
}
?>
</body>
</html>欢迎进入PHP开发资源论坛讨论。
相关文章
图文推荐
论 坛 资 源
·轻松了解十个重要的 MySQL客户启动选项
·细化解析:怎样修改 MySQL数据库中的密码
·解析:怎样在MySQL中获得更好的搜索结果
·怎样正确的解决 MySQL 中文模糊检索问题
·提高MySQL 查询效率的三个技巧
·PostgreSQL 数据库函数库
·Oracle 数据库函数库
·Oracle8数据库函数库
·php下sqlite开发心得
·关于Access数据库安全
·细化解析:怎样修改 MySQL数据库中的密码
·解析:怎样在MySQL中获得更好的搜索结果
·怎样正确的解决 MySQL 中文模糊检索问题
·提高MySQL 查询效率的三个技巧
·PostgreSQL 数据库函数库
·Oracle 数据库函数库
·Oracle8数据库函数库
·php下sqlite开发心得
·关于Access数据库安全
热门技术文档
·轻松了解十个重要的 MySQL客户启动选项
·细化解析:怎样修改 MySQL数据库中的密码
·解析:怎样在MySQL中获得更好的搜索结果
·怎样正确的解决 MySQL 中文模糊检索问题
·提高MySQL 查询效率的三个技巧
·PostgreSQL 数据库函数库
·Oracle 数据库函数库
·Oracle8数据库函数库
·php下sqlite开发心得
·关于Access数据库安全
·细化解析:怎样修改 MySQL数据库中的密码
·解析:怎样在MySQL中获得更好的搜索结果
·怎样正确的解决 MySQL 中文模糊检索问题
·提高MySQL 查询效率的三个技巧
·PostgreSQL 数据库函数库
·Oracle 数据库函数库
·Oracle8数据库函数库
·php下sqlite开发心得
·关于Access数据库安全
最新图文档
本站编辑推荐:(本站开通Delphi4PHP专区,欢迎进入论坛交流!)
- > 3分钟快速了解 Delphi for PHP 特色 (中文), PDF档
- > 购买Delphi for PHP的五大理由, PDF档
- > Delphi for PHP 使用规格介绍, PDF档
- > Delphi for PHP 問答集 (From CodeGear)
- > Delphi for PHP 产品价格表
编缉最近更新文章
网站赞助商
搜索您感兴趣的内容



