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)->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?