May 2005
Intermediate to advanced
352 pages
14h 39m
English
mysql_num_fields( )
mysql_num_fields(results)This returns the number from fields of the results set given.
...
$fields = mysql_list_fields('workrequests', 'workreq');
$num_fields = mysql_num_fields($fields);
for ($index = 0; $index < $num_fields; $index++) {
print mysql_field_name($fields, $index) . "\n";
}
...As this
example shows, mysql_num_fields( ) can be useful
in conjunction with other functions. Here a list of fields for a
table is retrieved using mysql_list_fields( ). In
order to help the code display the names of the fields using a
for statement, the number of fields needs to be
determined. The mysql_num_fields( ) function is
handy for figuring out this bit of information.
Read now
Unlock full access