+# like db_update() above, but instead of passing columns and data separately,
+# you can pass one array with the column names as keys and the data as values
+function db_update_assoc($table, $data) {
+ $args = func_get_args();
+ $args = array_slice($args, 2);
+ $columns = array();
+ $values = array();
+ foreach($data as $key => $value) {
+ $columns[] = $key;
+ $values[] = $value;
+ }
+ array_unshift($args, $values);
+ array_unshift($args, join(',', $columns));
+ array_unshift($args, $table);
+ call_user_func_array('db_update', $args);
+}
+