http://qdlover.yeah.net
An example of oracle+PHP query
Originally I didn’t use PHP, but many friends still asked me, so I made an example. Please check the manual for specific functions
In fact, Oracle’s functions are similar to others, except that it has an additional process of defining output variables.
Anyone who has studied pl/sql knows this (but I heard that only Tsinghua University and Xi’an Jiaotong University use it Make a website).
is OCIDefineByName($id, "ROWNUM",&$rownum); corresponding to the rownum in the query, one corresponding to one,
And the most important thing to note is that when defining, the field name must be in uppercase , because Oracle does not recognize lowercase
The rest is almost the same, assignment, display, closing the cursor
$conn = ocilogon("gcxx","gcxx","server1");
$id = OCIParse ($conn,"select rownum,gcdjbh,gcmc from zbgg");
OCIDefineByName($id,"ROWNUM",&$rownum);
OCIDefineByName($id,"GCDJBH",&$gcdjbh);
OCIDefineByName($id,"GCMC",&$gcmc);
OCIExecute($id);
$i=0;
while (OCIFetch($id)) {
echo "Serial number: ".$rownum."
";
echo "Project registration number: ".$gcdjbh."
";
echo "Project name:". $gcmc."
";
$i++;
if ($i>10) break;
}
OCIFreeStatement($id);
OCILogoff($conn);
?>
(Source: Viphot)