Forum und email

OCINumCols

(PHP 4, PHP 5, PECL oci8:1.0-1.2.4)

OCINumCols — Az eredményoszlopok száma egy eredménytáblában

Leírás

int OCINumCols ( int $stmt )

Az OCINumCols() visszaadja az eredménytábla oszlopainak a számát.

Example#1 OCINumCols

<?php   
    print "<HTML><PRE>\n";
    $conn = OCILogon("scott", "tiger");
    $stmt = OCIParse($conn,"select * from dolgozok");
    OCIExecute($stmt);
    while ( OCIFetch($stmt) ) {
        print "\n";
        $ncols = OCINumCols($stmt);
        for ( $i = 1; $i <= $ncols; $i++ ) {
            $oszlop_neve  = OCIColumnName($stmt,$i);
            $mezo_erteke = OCIResult($stmt,$i);
            print $oszlop_neve . ': ' . $mezo_erteke . "\n";
        }
        print "\n";
    }
    OCIFreeStatement($stmt);
    OCILogoff($conn);
    print "</PRE>";
    print "</HTML>\n";
?>