0
I needed to check if in the table mytable
, in the column mycolumn
, the value is 'meuvalor'
.
My controller:
public function GetValue()
{
$this->config->set_item('language', $this->session->errorMessagesLang);
$this->load->library('parser');
$name= $this->admin_model->getmycolumn();
if($name['mycolumn'] == 'meuvalor'){
//fazer o que eu quero
}
echo $result;}
My model:
public function getmycolumn()
{
$this->db->select('mycolumn');
$this->db->from('mytable');
$result = $this->db->get()->result();
return $result;
}
My problem is ifstatement, it is not able to solve my code, that is not check, I think it has to do with this:
$name['mycolumn'] == 'meuvalor'
doesn’t seem like the right syntax.
Any kind of help is welcome! PS: I just want to make it clear that I can get the value from the table, I just want to check if you have inside it the value I want.
Already solved, I will put here the answer for future people who have this problem, or similar. But thank you anyway!
– Gabriel Gomes