Đang chuẩn bị liên kết để tải về tài liệu:
MySQL Enterprise Solutions phần 5
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Bởi vì phần lớn nội dung là năng động, hiệu quả nội dung tĩnh không phải là quan trọng trong quyết định. Theo như nội dung động là có liên quan, PHP có một danh tiếng của hoạt động tốt hơn ASP. Mặc dù nó là khó khăn để đến với một chuẩn mực công bằng cho hai ngôn ngữ khác nhau, | D48 PHP Client Basics the C API you do not have to worry about buffer size. PHP again comes to the rescue and depending on your viewpoint you can say that it either frees programmers from thinking about annoying low-level implementation details and allows them to focus on the core of the problem or as some would say allows lazy and sloppy programmers to produce working code without correcting their evil ways and thus reinforcing the bad habits. Sample Code For the sample application I have chosen to write the Web version of our command-line inventory program from Chapter 8. Due to the Web nature of the code a good portion of it is dedicated to HTML generation and user form input processing. Although this may distract you from the database-manipulation techniques which is our primary goal I believe that since most uses of PHP are Web related and database programming is tightly coupled with the Web inter-face it is only natural to study HTML integration along with the database programming. To see the application in action copy sample.php from the Web site into a Web-accessible directory on your Web server make sure MySQL is installed and running on the same system and then type http webserver-hostname path to sample.php replacing the placeholder tokens with the actual values for example http localhost learn-mysql sample.php. You will see a menu of options. The first thing you need to do is select Initialize Database. Afterward you may add view delete and update records as well as view the totals. Listing 9.1 contains the sample code with my comments. It is my hope that the comments inside the code will help you understand the code but see the section that follows for a further discussion. auxiliary variable for proper HTML generation html_started 0 The line below tells PHP not to automatically escape user input values with quotes since we will be escaping them ourselves in the code. ini_set magic_quotes_gpc 0 Enable error tracking. We need this to have MySQL error in