How can I update this db_query statement to db_insert for D7? I'm trying to update someone's module to D7, but I'm unsure of how to convert the usage of places and values in the query to use 7's api properly.

$fields = implode(',', array_keys($args));
$places = implode(',', array_fill(0, count($args), "'%s'"));
$values = array_values($args);

$insert_result = db_query(
  'INSERT INTO {bluga_request}(' . $fields . ') VALUES (' . $places . ')', $values
);
The standard way is to use the db_insert() function with an associative array of field names/values:

$fields = array(
  'id' =&gt; $id,
  'name' =&gt; $name
);

db_insert('bluga_request')-&gt;fields($fields)-&gt;execute();


It actually looks like in your case the fields are already set up as an associative array in $args so you would just do this:

db_insert('bluga_request')-&gt;fields($args)-&gt;execute();