PHP's strength lies in its huge library of built-in functions, which allows even a novice user to perform very complicated tasks without having to install new libraries or worry about low-level details, as is often the case with other popular server-side languages like Perl. Because of the focus of this book, we've constrained ourselves to exploring only those functions that were directly related to MySQL databases (in fact, we didn't even see all of those). In this final instalment, we'll broaden our horizons a little and explore some of the other useful features PHP has to offer someone building a database driven Website.
We'll begin by learning about PHP's include function, which allows us to use a single piece of PHP code in multiple pages, and makes the use of common code fragments much more practical. We'll also see how to add an extra level of security to our site with this feature.
PHP, while generally quick and efficient, nevertheless adds to the load time and the workload of the machine on which the server is run. On high-traffic sites (sitepoint.com, for example!), this load can grow to unacceptable levels. But this challenge doesn't mean we have to abandon the database-driven nature of our site. We'll see how to use PHP behind the scenes to create semi-dynamic pages that don't stress the server as much.
A common question asked on sitepoint.com and in other sites' forums is how to use an <input type="file"> tag to accept file uploads from site visitors. We'll learn how to do this with PHP, and see how to make this fit into a database-driven site.
Finally, an extremely powerful feature of PHP is the ability to send email messages with dynamically generated content. Whether you want to use PHP to let visitors send email versions of your site's content to their friends, or just provide a way for users to retrieve their forgotten passwords, PHP's email function will serve nicely!