sql_fetchfield( string|field, [ int|number [, resource|query_id ] ] )
- Code: Select all
// Get username from the 21st row $field = $db->sql_fetchfield('username', 21, $result); // Get username in the current row $field = $db->sql_fetchfield('username');
Returns the content of one field (or table column) from one row in a SQL result set. The parameter field should be the name of the field to be returned. number should be the number of the row from which to return the field. If number is -1 (the default value), the current row will be used. See the special note for information on the query_id parameter.
Using sql_fetchrow to retrieve an entire row instead of a single field is recommended. sql_fetchrow will often be faster and in some cases sql_fetchfield actually calls sql_fetchrow or does the same work anyway. Also, on Oracle databases, the field will be returned entirely in uppercase.
See Also: mssql_result, mssql_fetch_array, mysql_result, OCIExecute, OCIFetch, OCIResult, pg_fetch_array