oci_num_fields

(PHP 5, PHP 7, PECL OCI8 >= 1.1.0)

oci_num_fields锟斤拷锟截斤拷锟斤拷械锟斤拷锟侥�

说锟斤拷

oci_num_fields ( resource $statement ) : int

oci_num_fields() 锟斤拷锟斤拷 statement 锟叫碉拷锟叫碉拷锟斤拷目锟斤拷

Example #1 oci_num_fields() 锟斤拷锟斤拷

<?php
    
echo "<pre>\n";
    
$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);

    echo 
"</pre>";
?>

oci_num_fields() 锟节筹拷锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

Note:

锟斤拷 PHP 5.0.0 之前锟侥版本锟斤拷锟斤拷使锟斤拷 ocinumcols() 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷煤锟斤拷锟斤拷锟斤拷锟饺伙拷锟斤拷茫锟轿拷锟斤拷录锟斤拷锟斤拷锟轿� oci_num_fields() 锟侥憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟窖憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟狡硷拷使锟矫★拷