Query: oci_num_fields
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
OCI_NUM_FIELDS(3) OCI_NUM_FIELDS(3) oci_num_fields - Returns the number of result columns in a statementSYNOPSISint oci_num_fields (resource $statement)DESCRIPTIONGets the number of columns in the given $statement.PARAMETERSo $statement - A valid OCI statement identifier.RETURN VALUESReturns the number of columns as an integer, or FALSE on errors.EXAMPLESExample #1 oci_num_fields(3) example <?php // Create the table with: // CREATE TABLE mytab (id NUMBER, quantity NUMBER); $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT * FROM mytab"); oci_execute($stid, OCI_DESCRIBE_ONLY); // Use OCI_DESCRIBE_ONLY if not fetching rows $ncols = oci_num_fields($stid); for ($i = 1; $i <= $ncols; $i++) { echo oci_field_name($stid, $i) . " " . oci_field_type($stid, $i) . "<br> "; } // Outputs: // ID NUMBER // QUANTITY NUMBER oci_free_statement($stid); oci_close($conn); ?>NOTESNote In PHP versions before 5.0.0 you must use ocinumcols(3) instead. This name still can be used, it was left as alias of oci_num_fields(3) for downwards compatability. This, however, is deprecated and not recommended. PHP Documentation Group OCI_NUM_FIELDS(3)
Related Man Pages |
---|
oci_define_by_name(3) - php |
oci_fetch_object(3) - php |
oci_field_type(3) - php |
oci_num_fields(3) - php |
oci_parse(3) - php |
Similar Topics in the Unix Linux Community |
---|
removing pattern which is spread in multiple lines |
nestes 'if' statement |
check number or character of a file |
IF && statement problem |
How to extract a number from a statement? |