Low cost ecommerce web development India flash website design

PHP retrieves MySQL data to produce Web pages


As shown in Figure 4.1, the PHP scripting language is the go-between that speaks
both languages. It processes the page request and fetches the data from the
MySQL database, then spits it out dynamically as the nicely-formatted HTML
page that the browser expects. With PHP, you can write the presentation aspects
of your site (the fancy graphics and page layouts) as "templates" in regular HTML.
Where the content belongs in those templates, you use some PHP code to connect
to the MySQL database and—using SQL queries just like those you used to create
a table of jokes in Chapter 2—retrieve and display some content in its place.
Just so it's clear and fresh in your mind, this is what will happen when someone
visits a page on your database-driven Website:
. The visitor's Web browser requests the Web page using a standard URL.
. The Web server software (Apache, IIS, or whatever) recognizes that the requested
file is a PHP script, and so the server interprets the file using its PHP
plug-in, before responding to the page request.
. Certain PHP commands (which you have yet to learn) connect to the MySQL
database and request the content that belongs in the Web page.
. The MySQL database responds by sending the requested content to the PHP
script.
. The PHP script stores the content into one or more PHP variables, and then
uses the now-familiar echo function to output the content as part of the Web
page.
70
Publishing MySQL Data on the Web
. The PHP plug-in finishes up by handing a copy of the HTML it has created
to the Web server.
. The Web server sends the HTML to the Web browser as it would a plain
HTML file, except that instead of coming directly from an HTML file, the
page is the output provided by the PHP plug-in.

website designer freelance ASP PHP ecommerce web developer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110