I have this method:
protected function _getByColumn($columnName, $value)
{
$sql = "SELECT * FROM $this->__tableName
WHERE :column = :value";
$stmt = $this->__db->prepare($sql);
$stmt->execute(array(':value' => $value, ':column' => $columnName));
$val=$stmt->fetch(PDO::FETCH_OBJ);
var_dump($val); //getting boolean false
}
am i doing something wrong in the way i do the PDO call? i had output $columnName
and $value
and also echod $sql
, manually replaed :column
and :value
, and everything worked. suggestions?
edit:
string 'SELECT * FROM myTable
WHERE :column = ':value'' (length=61)
string 'blog_id' (length=9)
string 'a3sasidsf' (length=8)
all values are as expected.