Chapter 7. MySQL and PHP


PHP and MySQL have been used together for years, and the combination has improved the popularity of both technologies. PHP now supports two different sets of MySQL functions. The original, mysql, is meant for working with versions of MySQL up to 4.1. The newer functions, mysqli (MySQL Improved), are available as of PHP 5 and take advantage of added MySQL features. These functions also offer speed and security benefits. For these reasons, this chapter will use the newer mysqli functions, which means that you must be using at least PHP 5 with MySQL 4.1.1 (with support for mysqli built into PHP). If you are using an older version of either PHP or MySQL, you'll need to use the original mysql extension. Documentation for those functions is available in the PHP manual, in my other books, and in oodles of places online.

This chapter provides the basic tools for PHP-MySQL interactions. I do not discuss the fundamentals of PHP at all. Chapter 12, "Techniques for Programming," expands upon the information discussed here, showing more advanced applications of these ideas.

In this chapter I will use the existing accounting database, creating a PHP interface for managing the expenses side of the application. Using the knowledge taught here, you should find it easy to make the corresponding scripts for the invoices half of the database.




MySQL Visual QuickStart Guide Serie  .Covers My SQL 4 and 5
MySQL, Second Edition
ISBN: 0321375734
EAN: 2147483647
Year: 2006
Pages: 162
Authors: Larry Ullman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net