If Your Web Host Provides PHP and MySQL - Page 10
January 3, 2002
It would be unfair of me to help you get everything installed and not even give you a taste of what a PHP-driven Web page looks like until Part 3, so here's a little something to whet your appetite.
Open up your favorite text or HTML editor and create a new file
If you prefer, you can download this file along with the rest of the code in this article series here.
Save this and place it on your Web site as you would any regular
HTML file, then view it in your browser. Note that if you view
the file on your own machine, you cannot use the
File, Open feature of your browser, because your
Web server must intervene to interpret the PHP code in the file.
Instead, you must move the file into the document root folder of
your Web server software (e.g.
Pretty neat, huh? If you use the ‘View Source' feature in
your browser, all you'll see is a regular HTML file with the date
in it. The PHP code (everything between
And don't worry too much about the exact code I used in this example. Before too long you'll know it like the back of your hand.
If you don't see the date, then something is wrong with the PHP
support in your Web server. Use View Source in your browser to
look at the code of the page. You'll probably see the PHP code
there in the page. Since the browser doesn't understand PHP, it
You should now have everything you need to get MySQL and PHP installed on your Web Server. If the little example above didn't work right (for example, if the raw PHP code appeared instead of the date), something went wrong with your setup procedure. Drop by the SitePoint.com Forums and we'll be glad to help you figure out the problem!
In Part 2, you'll learn the basics of relational databases and get started working with MySQL. If you've never even touched a database before, I promise you it'll be a real eye opener! Meanwhile, I'd love to hear what you thought of the first part of this series of articles. Drop me a line at firstname.lastname@example.org, or stop by the SitePoint.com Forums to speak your mind.