MySQL Database Class
I've been spending loads of time recently with a new project that's supposed to be comprised mostly of what I love doing the most: hardcore JavaScript. Unfortunately, most front-ends aren't much without a back-end to fall on, so I've had to hit the PHP pretty hard too.
When modifying the framework I had built, I noticed that the old database class I was using was a little out of date. PHP5 is the new standard, shouldn't we all be using PDO? So I added migrating to PDO to my to-do list. But really, the class is a pretty good one. It's certainly been useful to me for, well, almost a few years now, give or take a few dozen tweaks.
So given the longevity of the script, I thought I'd offer it up for this week's Script Sunday:
And here's a quick example of how to use it:
- [Download database.php.txt] (6,848 bytes)
- [Download db-class.zip] (1,966 bytes)
Just what I was looking for! Thanks!
It concerns me that your clean() method doesn’t use mysql_real_escape_string().