就是OCIDefineByName($id,"ROWNUM",&$rownum);对应了查询中的rownum,一个对应一个,
而且最应该注意的就是,在定义的时候,字段名必须是大写的,因为oracle里不认小写
其它的就差不多了,赋值,显示,关闭游标
$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 "序号:".$rownum."
";
echo "工程登记编号:".$gcdjbh."
";
echo "工程名称:".$gcmc."
";
$i++;
if ($i>10) break;
}
OCIFreeStatement($id);
OCILogoff($conn);
?>
时间: 2024-09-30 19:25:20