public function update($table, $data, $where)
{
// the base statement
$table = $this->quoteName($table);
$stmt = "UPDATE {$table} SET ";
// add "col = :col" pairs to the statement
$tmp = array();
foreach ($data as $col => $val) {
$tmp[] = $this->quoteName($col) . " = :{$col}";
}
$stmt .= implode(', ', $tmp);
// add the where clause
if ($where) {
$where = $this->quoteMulti($where, ' AND ');
$where = $this->quoteNamesIn($where);
$stmt .= " WHERE {$where}";
}
// execute the statement
$result = $this->query($stmt, $data);
return $result->rowCount();
}