I'm using prepared statements in PDO to select some data from my SQL server and I'm getting a syntax error:
QLSTATE[HY000]: General error: 10007 Incorrect syntax near 'memb_user'. [10007] (severity 5) [(null)] in
memb_user is the table name. Here is the prepared statement and the array that I'm using:
$query = "SELECT ?, ? FROM ? WHERE ? = ? AND ? = ?";
$data = array($this->columns['username'], $this->columns['password'], $this->table,
$this->columns['username'], $this->user , $this->columns['password'], $this->pass);
And this is how I'm executing the statement:
$statement = $this->connection->prepare($query);
$statement->execute($data);
I've tried putting the query into sql server and replacing the placeholder with correct values and it seems to be okay, only thing that was of concern was the quotes that needed to be in the WHERE conditionals. So am I executing this incorrectly?