> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_store_result.md).

# mysql\_stmt\_store\_result

## Syntax

```c
int mysql_stmt_store_result(MYSQL_STMT * stmt);
```

## Parameter

* `stmt` - a statement handle, which was previously allocated by [mysql\_stmt\_init()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_init.md).

## Description

You must call `mysql_stmt_store_result()` for every query that successfully produces a result set ([SELECT](/docs/server/reference/sql-statements/data-manipulation/selecting-data/select.md), [SHOW](/docs/server/reference/sql-statements/administrative-sql-statements/show.md), [DESCRIBE](/docs/server/reference/sql-statements/administrative-sql-statements/describe.md), [EXPLAIN](/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain.md)), and only if you want to buffer the complete result set by the client, so that the subsequent [mysql\_stmt\_fetch()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch.md) call returns buffered data.

## Return Value

Returns zero on success, nonzero if an error occurred.

{% hint style="info" %}
You can detect whether the statement produced a result set by checking the return value of [mysql\_stmt\_field\_count()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_field_count.md) function.
{% endhint %}

## See Also

* [mysql\_stmt\_field\_count()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_field_count.md)
* [mysql\_stmt\_fetch()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch.md)

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