HomeMySQL Performing Basic Tasks with MySQL 4.1 and Above, using mysqli with PHP 5
Performing Basic Tasks with MySQL 4.1 and Above, using mysqli with PHP 5
For anyone who has spent a few weeks working with PHP 5, the plethora of cool improvements and new features added to this incarnation of the language has brought a new, more powerful level for developing and deploying Web applications. These include the implementation of exceptions and the brand new object model. But what if I tell you that now you can use PHP 5 to work with MySQL, using an object-oriented approach?
All right, I know that you're now saying that's not breaking news, since the implementation of objects is an old programming feature. However, PHP 5 has a lot more to offer when it comes to using MySQL. If you're using MySQL 4.1 and above, the good news is that PHP 5 offers a fairly comprehensive extension, called "mysqli," which allows you to interact natively with MySQL via an object-based approach, aside from taking advantage of the new functionality provided by the database server.
If this subject already caught your curiosity, by using the "mysqli" library in conjunction with MySQL 4.1 and up, you'll be able to execute multiple queries in a single step, and process subsequent result sets. Also, the extension offers other advantages, such as using the "commit" and "rollback" features, all based on an easy-to-grasp object-oriented environment. Using a procedural approach is also possible if you wish.
As you can see, the "mysqli" library looks really interesting and useful, therefore in this series, I'll be introducing its most important methods and properties, along with the implementation of some advanced approaches, including the features that I mentioned before, and many more handy topics. At the end of the series, you should be equipped with a good background for using "mysqli" together with MySQL 4.1 and above.
So, let's not waste any more time in preliminaries and start exploring this cool PHP extension. Fun is already guaranteed!