A fundamental mistake that a (X web hosting) lot of beginners

A fundamental mistake that a lot of beginners make is to simply use the same variable names when creating SQL queries (for example, $sql = SELECT …). Assume that you simply copied and pasted, and then modified the movie query and movie result when it was called query. You d have two SQL queries called query and two results sets called $result. When the first result ran it would produce the expected results, as would the second one. However, if you ever wanted to refer to the results set that was returned from the first SQL, you d have a big problem. Why? The first results set would have been overwritten by the results of the second SQL query. For this reason, always ensure that you use different names for additional SQL queries and results sets returned from the query. Try It Out Displaying the Reviews The next chunk of code is the function that allows you to display a cool little graphic for the rating that each film received from the reviewer. We ve used one of our images (thumbsup.gif) but you can use anything on your local machine. Just make sure to use your own filename. 1. Add this code to movie_details.php: function generate_ratings($review_rating) { $movie_rating = ; for($i=0; $i<$review_rating; $i++) { $movie_rating .=   ; } return $movie_rating; } 2. Now add the code in the following lines immediately below the $movie_table_headings variable: $review_table_headings=<< Date of Review Review Title Reviewer Name Movie Review Comments Rating

EOD; 3. You need to add the next few lines after the review table headings section: while($review_row = mysql_fetch_array($review_result)) { $review_flag =1; $review_title[] = $review_row[ review_name ]; $reviewer_name[] = ucwords($review_row[ review_reviewer_name ]); $review[] = $review_row[ review_comment ]; $review_date[] = $review_row[ review_date ]; $review_rating[] = generate_ratings($review_row[ review_rating ]); } 4. Next, you need to add the following lines to the page: 131 Using Tables to Display Data
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision professional web hosting services

Leave a Reply