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.
[...]... the many aspects of programming PHP and MySQL Web applications, and the general ethos is of learning by doing instead of learning by reading 15 16 Practical PHP and MySQL SETTING UP PHP AND MYSQL When I started teaching people how to use PHP and MySQL, I would typically teach it within the safe confines of a computer lab, complete with a network of perfectly set up and configured machines My students... there is no PHP in there What happens is that the PHP 19 20 Practical PHP and MySQL interpreter on the server reads any PHP commands, executes them, and spits out HTML as the final output In this example, the PHP echo command was used to send the contents within the double quotes to the Web browser Each command in PHP ends in a semi-colon (;), and you can see it at the end of the echo command NOTE Using... STARTED WITH PHP PHP and HTML are good friends Working side by side, the PHP and HTML pals are so reliant on each other that it is virtually impossible to tear them apart Whenever you do any kind of Web development, you use PHP and HTML 17 18 Practical PHP and MySQL interchangeably on the vast majority of scripts that you write Both your HTML and PHP code will reside in any files that end in php To begin,... included PHP mail support This makes PHP better at supporting third-party extensions and has resulted in a huge number of freely available PEAR modules MySQL MySQL is a powerful and comprehensive relational database server, which was originally developed by David Axmark, Allan Larsson, and Michael “Monty” Widenius The commercial company they founded, MySQL AB, develops and markets 7 8 Practical PHP and MySQL. .. is an incredibly useful and often used feature in PHP Remember that you can only put HTML tags inside legitimate PHP commands You can’t just dump HTML inside a PHP block like this: < ?php Boogaloo with my didgeridoo ?> Everything inside the < ?php and ?> tags is expected to be PHP, and the tags are HTML (not PHP) Using Variables Variables are the bread and butter of any programming... file to handle the form submission This file contains PHP code that is used to connect to the database This PHP code is passed to the PHP interpreter by Apache and run by the interpreter PHP connects to the MySQL database (which may be on the same computer or another one; it doesn’t matter 11 12 Practical PHP and MySQL which) When connected to the MySQL database, a request is made for the information... some of the introductory aspects of learning PHP and MySQL This chapter provides a quick primer The intention of this chapter is not to be exhaustive, but to provide a solid introduction to PHP and MySQL enough to get you started writing applications Many PHP and MySQL books spend most of the time discussing abstract concepts that don’t relate in any way, and you can often see the eyes of the readers... that the Web browser can CHAPTER 2 Getting Started with PHP and MySQL understand You should always remember that the Web browser has no idea what PHP is The Web browser understands text, HTML, and CSS only It is the Web server that runs PHP that does the job of processing the PHP before sending the text, HTML, or CSS back to the browser Add a PHP block into your code: