Figure 4-7 While (Web hosting bandwidth) the script is collecting rows
Figure 4-7 While the script is collecting rows of reviews, if there are any reviews for the movie, you set a flag indicating this using the $review_flag variable. The code creates arrays to hold the values that will be returned. Why are you putting them into arrays and not just ordinary variables? This allows the variables to hold data for more than one review for the movie. After all, you expect that there ll be many, many reviews for each film. If you didn t create the review variables as arrays, then you d return only the last review for the movie. In the previous discussion, we looked at why we preferred to put the field values into a variable rather than echo out the field values. Take a look at the line reviewer_name. You ll notice that we have placed the line $review_row[ review_name ] inside the PHP function ucwords. This allows you to automatically perform the ucwords function (which capitalizes the first letter of each word) on the value returned from that field. The code then loops through the array and assigns values to each of the fields that you are going to display to the user for the review. You use the PHP sizeof function to calculate how many records have been returned. Finally, you ve broken the $movie_details variable up into several smaller chunks and added them through the use of .=<<<. Just as you have done before, you used an already-defined variable (in this case, $review_table_headings and $review_details) and just slotted it into the correct place. If the 133 Using Tables to Display Data
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision personal web hosting services