Chapter 15 . Perl Development 417 (Abyss web server) Another function

Chapter 15 . Perl Development 417 Another function in Figures 15-27 through 15-29 is of particular interest: fetchrow(). This and several related functions retrieve results from executed MySQL statements by using the DBI. The fetchfunctions are listed in Table 15-1. Table 15-1 Fetch functions to retrieve statement results Function name Description fetchrow() Retrieves one value. Useful where one value is selected as a result. fetchrow_array() Retrieves results and places them in an array. fetchrow_arrayref() Retrieves data as a referenced array. fetchall_arrayref Retrieves all data as a reference to an array. fetchrow_hashref() Retrieves data as a hash. Operates similarly to fetchrow_arrayref. I believe that examples of the different fetch functions serve better than a written explanation. For the examples in Figures 15-27 through 15-29, I retrieved only the first row of results. If you want to retrieve more than one row using the fetchrow() method, you have to loop through the results with a function such as while, as shown in Figure 15-30. Figure 15-30: Retrieving all the results for the query, using a while loop and fetchrow
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Leave a Reply