TAILIEUCHUNG - Beginning PHP6, Apache, MySQL Web Development- P6

Beginning PHP6, Apache, MySQL Web Development- P6:Welcome to Beginning PHP6, Apache, MySQL Web Development , your new trusty resource for assistance in creating your own dynamic web sites. There are a lot of technologies available that can be used to deliver great web sites, and we ’ re glad you chose the Apache/MySQL/PHP (sometimes referred to simply as AMP) approach. You may or may not have had a taste of these three components in the past, but either way we ’ re confident that you will be impressed with the power that lies within them | Chapter 4 Using Tables to Display Data How It Works First the script used the ALTER TABLE command to add the appropriate fields to the existing movie table and then it used the UPDATE command to insert the new data into those fields. If you aren t familiar with these commands you should consider reviewing Chapter 3 again. Now that you have the data in place you need to create a new page that you ll use to display the extra movie information . Try It Out Displaying Movie Details In this exercise you ll create a new page to display the data you added in the previous exercise. 1. Open your text editor and type the following program php take in the id of a director and return his her full name function get_director director_id global db query SELECT people_fullname FROM people WHERE people_id . director_id result mysql_query query db or die mysql_error db row mysql_fetch_assoc result extract row return people_fullname take in the id of a lead actor and return his her full name function get_leadactor leadactor_id global db query SELECT people_fullname FROM people WHERE people_id . leadactor_id result mysql_query query db or die mysql_error db row mysql_fetch_assoc result extract row 121 Part I Movie Review Web Site return people_fullname take in the id of a movie type and return the meaningful textual description function get_movietype type_id global db query SELECT movietype_label FROM movietype WHERE movietype_id . type_id result mysql_query query db or die mysql_error db row mysql_fetch_assoc result extract row return movietype_label function to calculate if a movie made a profit loss or just broke even function calculate_differences takings cost difference takings - cost if difference 0 color red difference . abs difference . million elseif difference 0 color green difference . difference . million else color blue difference broke even return span style color . color . . difference . span connect to MySQL db mysql_connect localhost bp6am bp6ampass

TỪ KHÓA LIÊN QUAN
TÀI LIỆU HOT