Answer the question
In order to leave comments, you need to log in
How to make a selection from the database if the column is named KEY?
Oru Chot.
Opencart has a setting table that stores store parameters. Each parameter is assigned a key.
The problem is that the key column is named with the reserved word KEY and I can't make a fetch using PDO because the query fails. What can be done in this situation?
$stmt = $this->dbh->prepare("SELECT * FROM z_setting WHERE key=:key");
$stmt->bindParam(':key', $key, PDO::PARAM_STR);
$stmt->execute();
return $stmt->fetchAll();
Answer the question
In order to leave comments, you need to log in
$stmt = $this->dbh->prepare("SELECT * FROM z_setting WHERE `key`=:key");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question