I use the codeigniter framework, I call from the view a selected data from a drop-down list in the following way:
$nombre_activo = $this->input->post('tipo_activo',true);
With this data I consult the database so that it brings me the id of the selected name.
public function id_activo($nombre_activo)
{
$query=$this->db
->select("id_tipo_activo")
->from("tipo_activo")
->where(array("nombre_tipo_activo"=>$nombre_activo))
->get();
//echo $this->db->last_query();exit;
return $query->row();
}
then in the controller I am calling what returns the query to me in the following way:
$id_activo = $this->activo_model->id_activo($nombre_activo);
I need to save the data obtained from the query in a variable type string, but what it is saving in the variable $ id_active is the following
stdClass Object ([id_type_type] = > 1)
How can I retrieve 1 of that std class?
I appreciate you can help me