db_query variable substitution I'm trying to substitute a variable in a db_query but keep on getting this error:

Recoverable fatal error: Argument 2 passed to db_query() must be of the type array, string given


It's a single item string that I'm trying to insert:

$primary_key = db_query("SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE (`TABLE_SCHEMA` = 'mydatabase') AND (`TABLE_NAME` = '%s') AND (`COLUMN_KEY` = 'PRI')",$mytable)-&gt;fetchAll(PDO::FETCH_ASSOC);


I've tried wrapping the variable in an array but then I get no results. How do I substitute my variable here?
Drupal 7 doesn't use the '%' place holders.  Try this:

$primary_key = db_query("SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE (`TABLE_SCHEMA` = 'mydatabase') AND (`TABLE_NAME` = :tbl_name) AND (`COLUMN_KEY` = 'PRI')", array(':tbl_name' =&gt; $mytable));