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

WBOY
Release: 2016-07-21 16:05:26
Original
811 people have browsed it

Create A Table Using OCI

Next we will create an email personal information book. This time OCI8 API command is used

Related PHP code:


PutEnv("ORACLE_SID=ORASID");

$connection = OCILogon ("username", " password");
if ($connection == false){
echo OCIError($connection)."
";
exit;
}

$query = "create table email_info " .
"(fullname varchar(255), email_address varchar(255))";

$cursor = OCIParse ($connection, $query);
if ($cursor == false){
echo OCIError($cursor)."
";
exit;
}

$result = OCIExecute ($cursor);
if ( $result == false){
echo OCIError($cursor)."
";
exit;
}

OCICommit ($connection);
OCILogoff ($ connection);

?>


We can see that the syntax of these two pieces of code is almost the same, the only difference is the function name; Secondly, in OCI8 we do not need to run it specifically When opening the cursor command, the system automatically returns a cursor ID when calling OCIParse.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315672.htmlTechArticleCreate A Table Using OCI Next we will create an email personal information book. This time OCI8 API instructions are used. Related PHP code: PutEnv(ORACLE_SID=ORASID); $connection = OCILogon (username, p...
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