Query: sqlsrv_num_fields
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
SQLSRV_NUM_FIELDS(3) SQLSRV_NUM_FIELDS(3) sqlsrv_num_fields - Retrieves the number of fields (columns) on a statementSYNOPSISmixed sqlsrv_num_fields (resource $stmt)DESCRIPTIONRetrieves the number of fields (columns) on a statement.PARAMETERSo $stmt - The statment for which the number of fields is returned. sqlsrv_num_fields(3) can be called on a statement before or after statement execution.RETURN VALUESReturns the number of fields on success. Returns FALSE otherwise.EXAMPLESExample #1 sqlsrv_num_fields(3) example <?php $serverName = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT * FROM Table_1"; $stmt = sqlsrv_query($conn, $sql); if( $stmt === false) { die( print_r( sqlsrv_errors(), true)); } $numFields = sqlsrv_num_fields( $stmt ); while( sqlsrv_fetch( $stmt )) { // Iterate through the fields of each row. for($i = 0; $i < $numFields; $i++) { { echo sqlsrv_get_field($stmt, $i)." "; } echo "<br />"; } ?>SEE ALSOsqlsrv_field_metadata(3), sqlsrv_fetch(3), sqlsrv_get_field(3). PHP Documentation Group SQLSRV_NUM_FIELDS(3)
Related Man Pages |
---|
sqlsrv_query(3) - php |
sqlsrv_send_stream_data(3) - php |
sqlsrv_fetch(3) - php |
sqlsrv_fetch_array(3) - php |
sqlsrv_next_result(3) - php |
Similar Topics in the Unix Linux Community |
---|
sql in shell script |
Using a variable in sqlplus |
need help deciphering this if statement |
convert file into sql insert stmt |
If echo statement return false |