PHP and Databases for the Lazy Sod - Conclusion (Page 6 of 6 )
In this article we have spoken about the benefits of atomic operations, database abstraction and the use of classes.
atomic operations - We have converted the usual gunk of working with databases into a small number of key functions that do no less and no more than needed.
database abstraction - We have created a new set of functions that are entirely database independent (simply by switching one include file). Even better, these new functions require much less code than traditional methods of working with databases (due to our atomic operation implementation).
classes - We have wrapped all of the above up into a nice, easy to use, class/object. This is handy because it allows us to do things like easily manage two concurrent server connections (should we so wish) as well as cache results and offers us neat functions that won't get confused with other global scope functions.
If you would like to see more examples of how to work with the class I've written (ezSQL) and how it can make your life easier, just go and have a look at http://php.justinvincent.com.
For a full-blown example of a busy website built using all the above concepts and the ezSQL class, visit http://vip.channel.ac.
It is a collaborative environment where about 2700 users post News, Pictures, Links and FAQs. It also has busy Forums and Live chat. It took about two months to build from scratch (no external scripts or software were used).
It gets approximately 95,000 hits to the mySQL database per day (all via ezSQL) and it runs like a charm.
If you would like to help by porting ezSQL to another database platform please feel free to do so and mail me the code (email@example.com).
I will include it in any future distributions. As stated, the only functions you need to change are $db->db, $db->select and $db->query. At the time of writing this article, ezSQL is available for mySQL and Oracle8.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.