Home >Backend Development >PHP Tutorial >How to use Oracle database in PHP (6)_PHP tutorial

How to use Oracle database in PHP (6)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:05:47957browse

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
... ...




http://www.bkjia.com/PHPjc/315630.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315630.htmlTechArticleUsing OCI to list all the data in the data table 'email_info' is the same as above, except that OCI is used to write the relevant PHP code : PutEnv(ORACLE_SID=ORASID); $connection = OCILogon (username,password); if ($co...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn