Prev | Current Page 881 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

This is the default setting.
While this option comes at a cost of increased memory demands, it does allow
you to work with the entire result set at once, which is useful when you??™re trying
to analyze or manage the set. For instance, you might want to determine how
many rows are returned from a particular query, or want to immediately jump
to a particular row in the set.
??? MYSQLI_USE_RESULT: Returns the result as an unbuffered set, meaning the set
will be retrieved on an as-needed basis from the server. Unbuffered result sets
increase performance for large result sets, but disallow the opportunity to do
various things with the result set, such as immediately determine how many rows
have been found by the query, or travel to a particular row offset. You should
consider using this option when you??™re trying to retrieve a very large number of
rows, because it will require less memory and produce a faster response time.
The following section shows how to use this method to send various queries to the
database.
Retrieving Data
Chances are your application will spend the majority of its efforts retrieving and formatting
requested data. To do so, you??™ll send the SELECT query to the database, and then
iterate over the results, outputting each row to the browser, formatted in any manner
you please.
The following example retrieves the sku, name, and price columns from the products
table, ordering the results by name.


Pages:
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893