# mysql\_use\_result

## Syntax

```c
MYSQL_RES * mysql_use_result(MYSQL * mysql);
```

* `mysql` - a mysql handle, which was previously allocated by [mysql\_init()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_init) or [mysql\_real\_connect()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect).

## Description

Used to initiate the retrieval of a result set from the last query executed using the `mysql_real_query()` function on the database connection. Either this or the [mysql\_store\_result()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_store_result) function must be called before the results of a query can be retrieved, and one or the other must be called to prevent the next query on that database connection from failing.

Returns an unbuffered result set or NULL if an error occurred.

{% hint style="info" %}
The `mysql_use_result()` function does not transfer the entire result set. Hence, several functions like [mysql\_num\_rows()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_num_rows) or [mysql\_data\_seek()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_data_seek) cannot be used.

`mysql_use_result()` will block the current connection until all result sets are retrieved, or result set was released by [mysql\_free\_result()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_free_result).
{% endhint %}

## See also

* [mysql\_store\_result()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_store_result)
* [mysql\_free\_result()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_free_result)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_use_result.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
