作者:黄自安_725 | 来源:互联网 | 2013-06-25 09:43
用php连接oracle首先要在php.ini中把extension=php_oci8.dllextension=php_oracle.dll前的分号“;”去掉,然后重启apache
用php连接oracle首先要在php.ini中把 extension=php_oci8.dll extension=php_oracle.dll 前的分号“;”去掉,然后重启apache就行了,这样php就支持oracle了.以下是程序代码:
$connection = Ora_Logon ("webmaster@phpzixue.cn", "123");
if ($connection == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."";
exit;
}
$cursor = Ora_Open ($connection);
if ($cursor == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."";
exit;
}
$query = "create table email_info " . "(fullname varchar(255), email_address varchar(255))";
$result = Ora_Parse ($cursor, $query);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."";
exit;
}
$result = Ora_Exec ($cursor);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."";
exit;
}
Ora_Commit ($connection);
Ora_Close ($cursor);
|