I'm usigne PHP doctrine DBAL and what I want to do is a get method like this:
function get($attr, $value){
$conn = DriverManager::getConnection($params, $config);
$sql = "SELECT * FROM mytable WHERE ? = ?";
$statement = $conn->executeQuery($sql, array($attrs, $value));
return $statement->fetchAll();
}
get("id", 1);
but it doesn't work. I wonder if is possible to obtein parametrization of columns as well as values. Here is the docs I'm using: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/data-retrieval-and-manipulation.html#executequery