downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<oci_new_descriptoroci_num_rows>
Last updated: Thu, 26 Jun 2008

oci_num_fields

(PHP 5, PECL oci8:1.1-1.2.4)

oci_num_fields — Returns the number of result columns in a statement

Description

int oci_num_fields ( resource $statement )

Gets the number of columns in the given statement .

Parameters

statement

A valid OCI statement identifier.

Return Values

Returns the number of columns as an integer, or FALSE on errors.

Examples

Example #1 oci_num_fields() example

<?php
$conn
= oci_connect("scott", "tiger");
$stmt = oci_parse($conn, "select * from emp");

oci_execute($stmt);

while (
oci_fetch($stmt)) {
   echo
"\n";
  
$ncols = oci_num_fields($stmt);
   for (
$i = 1; $i <= $ncols; $i++) {
      
$column_name  = oci_field_name($stmt, $i);
      
$column_value = oci_result($stmt, $i);
       echo
$column_name . ': ' . $column_value . "\n";
   }
   echo
"\n";
}

oci_free_statement($stmt);
oci_close($conn);
?>

Notes

Note: In PHP versions before 5.0.0 you must use ocinumcols() instead. This name still can be used, it was left as alias of oci_num_fields() for downwards compatability. This, however, is deprecated and not recommended.



add a noteadd a note User Contributed Notes
Returns the number of result columns in a statement
There are no user contributed notes for this page.




<oci_new_descriptoroci_num_rows>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs