PHP and MySQL Web Development - P51

PHP and MySQL Web Development - P51: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 10 Accessing Your MySQL Database from the Web with PHP P REVIOUSLY IN OUR WORK WITH PHP we used a flat file to store and retrieve data. When we looked at this in Chapter 2 Storing and Retrieving Data we mentioned that relational database systems make a lot of these storage and retrieval tasks easier safer and more efficient in a Web application. Now having worked with MySQL to create a database we can begin connecting this database to a Web-based front end. In this chapter we ll explain how to access the Book-O-Rama database from the Web using PHP. You ll learn how to read from and write to the database and how to filter potentially troublesome input data. Overall we ll look at How Web database architectures work The basic steps in querying a database from the Web Setting up a connection Getting information about available databases Choosing a database to use Querying the database Retrieving the query results Disconnecting from the database Putting new information in the database Other useful PHP MySQL functions Using a generic database interface PEAR DB Other PHP-database interfaces 224 Chapter 10 Accessing Your MySQL Database from the Web with PHP How Web Database Architectures Work In Chapter 7 Designing Your Web Database we outlined how Web database architectures work. Just to remind you here are the steps again 1. A user s Web browser issues an HTTP request for a particular Web page. For example the user might have requested a search for all the books written by Michael Morgan at Book-O-Rama using an HTML form. The search results page is called . 2. The Web server receives the request for retrieves the file and passes it to the PHP engine for processing. 3. The PHP engine begins parsing the script. Inside the script is a command to connect to the database and execute a query perform the search for books . PHP opens a connection to the MySQL server and sends on the appropriate query. 4. The MySQL server receives the database query .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
129    483    2    20-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.