mysqli::store_result
mysqli_store_result
(PHP 5, PHP 7)
mysqli::store_result -- mysqli_store_result — Transfers a result set from the last query
Description
Object oriented style
Procedural style
Transfers the result set from the last query on the database connection
represented by the link
parameter to be used with
the mysqli_data_seek() function.
Parameters
-
link
-
Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()
-
option
-
The option that you want to set. It can be one of the following values:
Valid options Name Description MYSQLI_STORE_RESULT_COPY_DATA
Copy results from the internal mysqlnd buffer into the PHP variables fetched. By default, mysqlnd will use a reference logic to avoid copying and duplicating results held in memory. For certain result sets, for example, result sets with many small rows, the copy approach can reduce the overall memory usage because PHP variables holding results may be released earlier (available with mysqlnd only, since PHP 5.6.0)
Return Values
Returns a buffered result object or FALSE
if an error occurred.
Note:
mysqli_store_result() returns
FALSE
in case the query didn't return a result set (if the query was, for example an INSERT statement). This function also returnsFALSE
if the reading of the result set failed. You can check if you have got an error by checking if mysqli_error() doesn't return an empty string, if mysqli_errno() returns a non zero value, or if mysqli_field_count() returns a non zero value. Also possible reason for this function returningFALSE
after successful call to mysqli_query() can be too large result set (memory for it cannot be allocated). If mysqli_field_count() returns a non-zero value, the statement should have produced a non-empty result set.
Notes
Note:
Although it is always good practice to free the memory used by the result of a query using the mysqli_free_result() function, when transferring large result sets using the mysqli_store_result() this becomes particularly important.
See Also
- mysqli_real_query() - Execute an SQL query
- mysqli_use_result() - Initiate a result set retrieval
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-mysqli.store-result.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.