function query_to_hash($query) { $ret = array(); $result = sql_query_dbg($query); while ($row = sql_fetch_row($result)) { $ret[$row[0]] = $row[1]; } return $ret; }
function update_records($table, $conditions, $newdata) { $newdata = array_escape($newdata); $column_quote_func = db_params('column_quote_func'); array_walk($newdata, $column_quote_func); if (count($newdata) > 0) { $query = "UPDATE " . $table . " SET " . implode(", ", $newdata) . sql_where($conditions); $result = sql_query_dbg($query); return sql_affected_rows($result); } return FALSE; }