Home > Backend Development > PHP Tutorial > Teach you how to use Oracle database in PHP (6)

Teach you how to use Oracle database in PHP (6)

WBOY
Release: 2016-08-08 09:33:42
Original
899 people have browsed it

Teach you how to use Oracle database in PHP (6)

Use OCI to list all data in the data table 'email_info'



Same as above, but written in OCI

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:


Name Email address
Spring Flower sPRingflower@163.com
autumn moon autumnmoon@163.com
... ...​

The above has introduced how to use Oracle database in PHP (6), including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template