PHP MySQLi Wrapper Class Complex WHERE

If you have ever had a chance to use a PHP active record class for MySQL, you would notice that most of them don’t support complex where statements. I’ve had a chance today to address this feature request that I was received from a user of my PHP MySQLi wrapper class.

Adding a complex WHERE clause is now simple.


$db->where('foo', 15);
$db->open_where();
$db->or_where('foo <', 15); $db->where('bar >=', 15);
$db->close_where();
// Produces SELECT `column` FROM `table` WHERE `foo` = 15 OR (`foo` < 15 AND `bar` >= 15)

For more information on this class and download it, visit the repository on Bitbucket.

Leave a Reply

Your email address will not be published. Required fields are marked *