# mysql\_stmt\_store\_result

## Syntax

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

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

## Description

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

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\_result\_metadata()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_result_metadata) function.
{% endhint %}

## See Also

* [mysql\_stmt\_result\_metadata()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_result_metadata)
* [mysql\_stmt\_fetch()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch)

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