Name
mysql_field_count( )
Synopsis
unsigned int mysql_field_count(MYSQL *mysql)
This returns the number of columns in a
results set. You can also use this function to test whether there was
an error in a SELECT
query. A
SELECT
query will return at least one blank field
when there is an error, resulting in a value of 0 for the function.
... if(!result) { if(mysql_field_count(mysql) = = 0) { printf("Error \n"); exit(EXIT FAILURE); } } ...
See the entry for the
mysql_fetch_row( )
function for another example
involving this function.
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.