How to use Oracle Database in PHP (5) _php Basics

Source: Internet
Author: User
Tags html form oracle database
Use Ora to list data in all datasheet ' Email_info '


Below, we will read out the contents of the database, and display the data in the ' Email_info ' datasheet as an HTML form

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 springflower@163.com
Autumn Moon autumnmoon@163.com
... ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.