Difference between mysql_store_result and mysql_use_result _ MySQL

Source: Internet
Author: User
The difference between mysql_store_result and mysql_use_result is that after using mysql_query () for a query, one of these two functions is generally used to store the result in a MYSQL_RES * variable.

The main difference between the two is that the results of mysql_use_result () must be used up once. that is to say, after using mysql_fetch_row () to get a result, you must use mysql_fetch_row () repeatedly () read the result until the function returns null. Otherwise, if you perform another mysql Query, the error "Commands out of sync; you can't run this command now" will be returned.

Mysql_store_result () saves the result. you can perform another query without reading all the rows. For example, if you perform a query to obtain a series of records, and then use a loop to query the database, you can only use mysql_store_result ().

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.