Name

mysql_list_fields( )

Synopsis

MYSQL_RES *mysql_list_fields(MYSQL *mysql, const char *table,
                             const char *wild)

This returns a results set containing a list of fields found for the table given as the second argument to the function. An expression may be given as the third argument to select fields whose names match a certain pattern. The % or may be used as wildcards. If NULL is given for the third argument, all fields for the table are returned. The results set must be freed when finished.

...
result = mysql_list_fields(mysql, "stores", "s%");
num_rows = mysql_num_rows(result);
printf("Rows: %d \n", num_rows);
while((row = mysql_fetch_row(result)) != NULL)
   {
    for(i = 0; i < num_rows; i++)
      { printf("%s \n", row[i]); }
   }
mysql_free_result(result);
...

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.