You can call the mysql_fetch_row() function to retrieve the next row in a result set.
Syntax
MYSQL_ROW
mysql_fetch_row(MYSQL_RES *result)
Return values
A MYSQL_ROW structure for the next row or NULL is returned. NULL is returned in the following cases:
When used after
mysql_store_result(),mysql_fetch_row()returnsNULLif no more row can be retrieved.When used after
mysql_use_result(),mysql_fetch_row()returnsNULLif no more row can be retrieved or an error occurs.To determine whether an error occurred, check whether
mysql_error()returns a nonempty string ormysql_errno()returns a non-zero value.
Errors
CR_SERVER_LOST: The connection to the server was lost during the query.CR_UNKNOWN_ERROR: An unknown error occurred.
Errors are not reset during mysql_fetch_row() calls.
Notes
The number of values in the row is specified by
mysql_num_fields(result). Ifrowcontains the return value from a call tomysql_fetch_row(), the access range of pointers to the value is fromrow[0]torow[mysql_num_fields(result)-1].NULLvalues in the row are indicated byNULLpointers. If the pointer isNULL, the field isNULL. Otherwise, the field is empty.The lengths of the field values in the row may be obtained by calling
mysql_fetch_lengths(). The length of empty fields and fields containingNULLis 0.