Go to the first, previous, next, last section, table of contents.


What is the difference between mysql_use_result() and mysql_store_result() modes?

mysql_use_results reads the result directly from the server without storing it in a temporary table or local buffer. This is somewhat faster and uses much less memory than mysql_store_result. One shouldn't use mysql_use_results if there is a lot of processing being done for each row at the client side, or if the output is sent to a screen on which the user may do a ^S (stop scroll). Doing this would tie up the server and then other threads couldn't update the used tables. One can't use mysql_data_seek mysql_num_rows or issue other queries while using mysql_use_result.

When using mysql_use_result one must execute mysql_fetch_row() until one gets a NULL pointer back, because else the next query would get results from the previous query. The C API will give the error: Commands out of sync; You can't run this command now, if you forget to do this!


Go to the first, previous, next, last section, table of contents.