New to OOP.
Trying to query the database for a specific row. Database is structured as: id - title - value
(I am trying to query match title and get the subsequent value)
The query either results in Array or is simply blank.
Certain my formatting is mixed up or incorrect somewhere. Can anyone spot what I'm doing wrong?
Query (which inside the same model where this is being called from) catalog/model/order.php:
public function getTemplate($title) {
$query = $this->db->query("SELECT * FROM km_mail_templates WHERE `title` = '" . $this->db->escape($title) . "'");
foreach ($query->rows as $result) {
$template_data[$result['title']] = $result['value'];
}
return $template_data;
}
Variables I am trying to call:
public function index() {//called from within order.php model
$this->getTemplate()['new_greeting'];
}
Also tried:
$this->model_catalog_order->getTemplate()['new_greeting'];
and
$this->model_catalog_order->getTemplate('new_greeting');