Retrieves the position of a field in a result set given a field name.
Syntax
int ads_field_num( resource result_id,
string field_name )
Parameters
result_id (I) |
ID of a result set. |
field_name (I) |
Name of a field in a result set. |
Remarks
ads_field_num returns the position of a field in a result set given a field name or returns False in the event of an error. The index of the first field of a result set is 1.
Example
<?
echo "Connecting to Server<br>\n";
$rConn = ads_connect( "DataDirectory=\\\\server1\\share1\\data\\;ServerTypes=2", "", "" );
echo "Connected<br>\n";
echo "Retrieve the customers.<br>\n";
$rResult = ads_do( $rConn, "SELECT * FROM customers" );
echo "Retrieve the field number of the CREDIT_LIMIT field.<br>\n";
$iField = ads_field_num( $rResult, "CREDIT_LIMIT" );
echo "CREDIT_LIMIT is field number: " . $iField . "<br>\n";
echo "Closing the connection<br>\n";
ads_close( $rConn );
echo "Disconnected<br>\n";
?>
See Also