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

WBOY
Release: 2016-08-08 09:33:41
Original
949 people have browsed it

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

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



Next, we will read out the contents of the database one by one and display the data in the 'email_info' data table in an html table

Related php code:


PutEnv("Oracle_SID=ORASID");

$connection = Ora_Logon ("username","passWord");
if ($connection == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."
";
exit;
}

$cursor = Ora_Open ($connection);
if ($cursor == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."
";
exit;
}

$query = "select * from email_info";
$result = Ora_Parse ($cursor, $query);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."
";
exit;
}

$result = Ora_Exec ($cursor);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."
";
exit;
}

echo " ";
echo " Full Name Email Address
";

while (Ora_Fetch_Into ($cursor, &$values)){
$name = $values[0];
$email = $values[1];

echo " $name $email
";
}

echo " ";

Ora_Close ($cursor);
Ora_Logoff ($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 teaching you how to use Oracle database in PHP (5), including various aspects. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!