範文齋

用php連接oracle數據庫的代碼

用php連接oracle首先要在中把extension=php_xtension=php_前的分號“;”去掉,然後重啓apache就行了,這樣php就支持oracle了.以下是程序代碼:

用php連接oracle數據庫的代碼

$connection=Ora_","123");

if($connection==false){

echoOra_ErrorCode($connection).":"_Error($connection)."";

exit;

$cursor=Ora_Open($connection);

if($cursor==false){

echoOra_ErrorCode($connection).":"_Error($connection)."";

exit;

$query="createtableemail_info"."(fullnamevar255),email_addressvar255))";

$result=Ora_Parse($cursor,$query);

if($result==false){

echoOra_ErrorCode($cursor).":"_Error($cursor)."";

exit;

$result=Ora_Exec($cursor);

if($result==false){

echoOra_ErrorCode($cursor).":"_Error($cursor)."";

exit;

Ora_Commit($connection);

Ora_Close($cursor);

Ora_Logoff($connection);