<p>Several months ago my work deployed an in-house function that wraps the standard, php, mysql_query() function with additional options and abilities. A sample feature would be some handy debugging tools we can turn on/off. </p>

<p>I was wondering how popular query handlers are and what features people like to build into them.</p>

I use a DBAL like
MDB2
,
Zend_Db
or
Doctrine
for similar reason. Primarily to be able to utilize all the shortcuts it offers, not so much for the fact that it supports different databases.
E.g., old:
```
```
<?php
$query  = "SELECT * FROM table";
$result = mysql_query($query);
if (!$result) {
  echo mysql_error();
} else {
  if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_obj($result)) {
      ...
    }
  }
}
?>
```
```
Versus (Zend_Db):
```
```
<?php
try {
  $result = $db->fetchAll("SELECT * FROM table");
  foreach($result as $row) {
    ...
  }
} catch (Zend_Exception $e) {
  echo $e->getMessage();
}
?>
```
```
IMHO, more intuitive.