Home >Backend Development >PHP Tutorial >How to use Oracle database in PHP (6)_PHP tutorial
Use OCI to list all the data in the data table 'email_info'
Same as above, but use OCI to write
Related PHP code:
PutEnv ("ORACLE_SID=ORASID");
$connection = OCILogon ("username","password");
if ($connection == false){
echo OCIError($connection). "
";
exit;
}
$query = "select * from email_info";
$cursor = OCIParse ($connection, $query);
if ($cursor == false){
echo OCIError($cursor)."
";
exit;
}
$result = OCIExecute ($cursor);
if ($result == false){
echo OCIError($cursor)."
";
exit;
}
echo " ";
echo " Full Name Email Address "
";
while (OCIFetchInto ($cursor, $values)){
$name = $values[0];
$email = $values[1] ;
echo " $name $email
";
}
echo " ";
OCILogoff ($connection);
?>
The browsing effect of the program running is as follows:
com
... ...