The web server software (typically Apache or NGINX) recognizes that the requested file is a PHP script, so the server fires up the PHP interpreter to execute the code contained in the file.The visitor’s web browser requests the web page from your web server. Just so it’s clear and fresh in your mind, this is what happens when there’s a visitor to a page on your website: It then spits it out dynamically as the nicely formatted HTML page that the browser expects. It processes the page request and fetches the data from the MySQL database using SQL queries just like those you used to create a table of jokes in Chapter 3. At the other end you have the content of your site, which sits in one or more tables in a MySQL database that only understands how to respond to SQL queries (commands).Īs shown in the image above, the PHP scripting language is the go-between that speaks both languages. That browser expects to receive a standard HTML document in return. So, at one end of the system you have a visitor to your site using a web browser to request a page. The purpose of using MySQL for our website is to allow the content to be pulled dynamically from the database to create web pages for viewing in a regular browser. It’s important to understand how these will fit together. We have two powerful tools at our disposal: the PHP scripting language and the MySQL database engine. There are numerous references in this chapter - and in the PHP code you’ll write - to “MySQL”, even though we’re actually connecting to a MariaDB database.īefore we leap forward, it’s worth taking a step back for a clear picture of our ultimate goal. Note: as in Chapter 3, I’m using “MySQL” here to refer to the database protocol. Now you’re ready to learn how to use these tools together to create a website where users can view data from the database and even add their own. So far, you’ve written your first PHP code and learned the basics of MySQL, a relational database engine, and PHP, a server-side scripting language. This is it - the stuff you signed up for! In this chapter, you’ll learn how to take information stored in a MySQL database and display it on a web page for all to see. Displaying Data from MySQL on the Web: an Introduction.Setting Up Your PHP Development Environment with Docker.In this final tutorial in the series, you’ll learn how to take information stored in a MySQL database and display it on a web page for all to see. The following article is an excerpt from PHP & MySQL: Novice to Ninja, 7th Edition, a hands-on guide to learning all the tools, principles, and techniques needed to build a professional web application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |