The blow code will show error:
function connect()
{
putenv("ORACLE_SID=ORCL");
putenv("ORACLE_HOME=/opt/app/oracle/product/8.0.5");
$conn = ocilogon("wz","wzforedu");
return $conn;
}
function select()
{
connect();
$sql="select * from module ";
$stmt = OCIParse($conn,$sql);
ociexecute($stmt);
OCIFreeStatement($stmt);
OCILogoff($conn);
return 1;
}
if I assembled the two function as below,It will work.
function select()
{
putenv("ORACLE_SID=ORCL");
putenv("ORACLE_HOME=/opt/app/oracle/product/8.0.5");
$conn = ocilogon("wz","wzforedu");
$sql="select * from module ";
$stmt = OCIParse($conn,$sql);
ociexecute($stmt);
OCIFreeStatement($stmt);
OCILogoff($conn);
return 1;
}
why?