Home  >  Article  >  php教程  >  一个oracle+PHP的查询的例子

一个oracle+PHP的查询的例子

WBOY
WBOYOriginal
2016-06-21 09:02:261920browse

 

  
  
就是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);
  ?>



Statement:
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