an update from my previous question..
this is my code in the model.
function member_here()
{
$this->db->select('');
$this->db->from('membership');
$this->db->where('username',$this->input->post('username'));
$q=$this->db->get();
if($q->num_rows() > 0) {
$data = array('first_name');
foreach($q->result() as $row) {
$data=$row;
}
return $data;
}
}
and this is my code in the view form:
<?php
$CI =& get_instance();
$CI->load->model('membership_model');
$result = $CI->membership_model->member_here();
print_r($result);
?>
now. i have a problem.
the output is this:
stdClass Object ( [id] => 10 [first_name] => Marishka [last_name] => Villamin [username] => marishkapv [password] => 01aef487205966f24dd694ca4153ccbb [email_address] => marishkapv@gmail.com )
i dont need that output. instead i want my output to be Marishka which is the value of the first_name field.
help please
You just need to echo out the part of the object you want, not the entire object. And for the record you shouldn’t be getting any data from the model in the view, that should all be done in the controller.