Problème avec Zend_Db_Table_Abstract
Bonjour à tous,
J'ai un problème récurent lorsque je cherche à récupérer un row avec autres chose que son id.
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
// getter db mapper
public function get($key) {
$db = $this->getDbTable();
$row = $db->fetchRow($db->select()->where('index = ?', $key));
if (0 == count($row)) {
return;
} else {
return $row->value;
}
} |
Cette table contiens 5 champs
id (int)
index (varchar)
value (varchar)
lastupdate (int)
Lorsque je recherche via id aucun problème (mais j'ai une méthode find pour ca), cependant lorsque je recherche avec autres chose que l'id en condition where j'obtiens l'erreur:
Code:
1 2 3 4 5 6 7 8
|
An error occurred
Application error
Exception information:
Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index = 'siteName') LIMIT 1' at line 1 |
Merci de votre aide