Tài liệu về học lập trình web bằng ngôn ngữ PHP cho tất cả mọi người.
[...]... Using PHP with MySQL There are several factors that make using PHP and MySQL together a natural choice: PHP and MySQL work well together PHP and MySQL have been developed with each other in mind, so they are easy to use together The programming interfaces between them are logically paired up Working together wasn’t an afterthought when the developers created the PHP and MySQL interfaces PHP and MySQL. .. purchase professional support for MySQL if you need it PHP and MySQL are fast Their simple and efficient designs enable faster processing PHP and MySQL don’t bog you down with unnecessary details You don’t need to know all of the low-level details of how the PHP language interfaces with the MySQL database, as there is a standard interface for calling MySQL procedures from PHP Online application programming... web server detects that the PHP file isn’t just a plain HTML file, so it asks another process—the PHP interpreter—to process the file 6 The PHP interpreter executes the PHP code that it finds in the text it received from the web server process Included in that code are calls to the MySQL database 7 PHP asks the MySQL database process to execute the database calls 8 The MySQL database process returns... contained within the PHP framework This means that there’s no reason for you to reinvent the wheel each time you sit down to develop a PHP program; it comes with web functionality built-in While PHP is great for web application development, it doesn’t store information by itself For that, you need a database The database of choice for PHP developers is MySQL, which acts like a filing clerk for PHP- processed... purpose of Apache (your web server), PHP (your server-side programming language), and MySQL (your database) This can help you to understand how they fit into the web development picture Remember that dynamic web pages pull information from several sources simultaneously, including Apache, PHP, MySQL, and Cascading Style Sheets (CSS), which we’ll talk about later PHP PHP grew out of a need for people to... CSS, PHP templates, and a MySQL database all at once PHP templates make it easier to Integrating Many Sources of Information | 7 change the HTML in a page when it contains fields populated by a database query We’ll take a quick look at how these pieces come together Just to give you a taste of what your code will look like, Example 1-1 shows MySQL code called from PHP for inserting a comment into a MySQL. .. page, PHP and MySQL are added to the mix Figure 1-3 illustrates the extra steps that occur in the chain of events on the web host Each step in the chain is listed here: 12 | Chapter 1: Dynamic Content and the Web http://www.plane.com/login .php 1 Web host Your computer 2 3 Request Web server Internet Response 11 Response 6 5 PHP interpreter Request 9 10 Word 4 Hard disk 8 7 MySQL Email Figure 1-3 The PHP. .. interfaces PHP and MySQL have open source power As they are both open source projects, PHP and MySQL can both be used for free MySQL client libraries are no longer bundled with PHP Advanced users have the ability to make changes to the source code, and therefore change the way the language and programs work PHP and MySQL have community support Both tools active communities on the Web in which you can... Apache • PHP • MySQL You need to install the programs in that order All our examples will be from the installation perspective of a PC with Windows installed, with notes for Macintosh and Linux systems 15 The easiest way to install Apache, PHP, and MySQL on most Linux systems is to download a packaged distribution All popular Linux distributions have prebuilt packages from Apache, PHP, and MySQL For... successful Now that you can serve up web pages, you’re ready to add PHP 20 | Chapter 2: Installation Figure 2-8 Apache’s default index page after installation Installing PHP Go to http://www .php. net/downloads .php to download the latest version of PHP; both binaries and source code can be found on this web site Under Windows Binaries, select the PHP 5.x installer where x is the latest available version Select