I cannot get my head around how to do this. I have a mysql table called 'companies' that has a column called 'language'. This language column contains country abbreviations (en, de, es...).
Then I have flags saved in media/images/flags (en.png, de.png, es.png...).
I do not want to save the flags in db but I want to change db-country abbrevs. into flags inside the code. Below, I store the country abbrevs from db inside abbrevs. and try somehow to match them to array keys.
Model (platform_model):
public function get_country(){
$query = $this->db->query("SELECT language FROM companies");
return $query;
}
Controller:
public function set_flag(){
$this->load->model('platform_model');
$abbrevs = $this->platform_model->get_country();
$flags = array(
'de' => base_url('media/images/flags/de.png'),
'en' => base_url('media/images/flags/en.png'),
'it' => base_url('media/images/flags/it.png'),
'fr' => base_url('media/images/flags/fr.png'),
'es' => base_url('media/images/flags/fr.png'),
'pt' => base_url('media/images/flags/pt.png'),
'ru' => base_url('media/images/flags/ru.png'),
'ch' => base_url('media/images/flags/ch.png'),
'ja' => base_url('media/images/flags/ja.png')
);
//how can I compare/replace them from here?
Thank you for help.