You can call the mysql_list_fields() function to return field names that match the simple regular expression specified by the wild argument.
Syntax
MYSQL_RES *
mysql_list_fields(MYSQL *mysql,
const char *table,
const char *wild)
wild may contain the % or _ wildcard character, or may be a NULL pointer to match all fields.
Return values
A MYSQL_RES result set is returned for an execution success, and NULL is returned if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC: Commands were executed in an improper order.CR_SERVER_GONE_ERROR: The connection to the OBServer was disconnected.CR_SERVER_LOST: The connection to the server was lost during the query.CR_UNKNOWN_ERROR: An unknown error occurred.
Notes
Calling mysql_list_fields() is similar to executing the query SHOW COLUMNS FROM tbl_name [LIKE wild]. We recommend that you use SHOW COLUMNS FROM tbl_name instead of mysql_list_fields().
After the call is completed, you must free the result set with mysql_free_result().