$movie_cost = $row[ movie_cost ]; //get director s name (Top web site) from people

$movie_cost = $row[ movie_cost ]; //get director s name from people table get_director(); //get lead actor s name from people table get_leadactor(); } How It Works Because you ve already written the functions to get the director s and lead actor s names, you borrowed this code from the table2.php file. Then you ve changed the query to return everything in each record, as opposed to only a few fields. It does mean that you are returning one field that you are not actually using. The query now contains a WHERE clause. This determines which record you are going to retrieve the data from. Take a look at the WHERE clause (it s not as daunting as it first seems): . You have used $_GET[ movie_id ] in the WHERE clause. This is the ID of the movie that was passed from the hyperlink in table3.php. . You ve also created the variable $movie_table_headings to contain the headings for the fields that you ll be using. . The rest of the code is very similar to the code in table3.php. You ve added four extra fields to the while control loop. Didn t we say previously that returning fields that you don t need is not good practice? Yes, we did. However, in this case you are returning only one more field than you need, as opposed to returning many redundant fields. So are we going against our own advice? To be 100 percent truthful, yes. However, because you are using the vast majority of fields in each record, PHP will not suffer from this tradeoff, and it is worth it. You would not want to do this when, for example, you want the values of (say) 5 fields and the record structure contains 50 fields. If you did this in that instance, PHP would be wasting resources to return the other 45 fields. So now that you ve arranged to return information from records, what next? Now you put this extra information to work. Try It Out Displaying Movie Details In this exercise, you ll enhance the movie_details page with your new data. 1. Add the following lines of code to the end of movie_details.php: $movie_health = calculate_differences($movie_takings, $movie_cost); $page_start =<< 126 Chapter 4
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision ecommerce web hosting services