note 43357 deleted from function.odbc-field-name by nlopess
| From: | nlopess@php.net | Date: | Fri, 18 Jun 2004 15:32:09 +0000 |
| Subject: | note 43357 deleted from function.odbc-field-name by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71293@lists.php.net to get a copy of this message | ||
Note Submitter: mike@jcsvc.com
----
Here is a function that will allow you to call data by the fieldname:
function odbc_named_results($results,$fieldname){
$field_array = array();
$fCount = odbc_num_fields($results);
for($i = 1 ; $i < $fCount ; $i++){
$field_array[odbc_field_name ($results, $i)] = $i;
}
return odbc_result($results,$field_array[$fieldname]);
}
Syntax is:
odbc_named_results($results,"fieldname");